mkmeden's blog

By mkmeden, history, 2 years ago, In English

https://cses.fi/problemset/task/1671/

This is the task and at the first look its obvious that its a standard dijkstra problem, But due to some reason my code is giving TLE for 2 large test cases which I am sure the standard dijkstra code should be able to handle. Can someone take a look at this and provide some insight.

code

Failing TCs : https://cses.fi/file/6202e05529aba02706fe1c03ec7d07ed68c2e254b69047129b52185f875b9a1e/1/1/ https://cses.fi/file/a563cff68cf3d8ade012345cf49bc668cdb1f02f7a75317091066f81c0db16d5/1/1/

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

Can some one help me undertand why this solution is giving a TLE for a particular test case.

Task :https://cses.fi/problemset/task/1193/

Solution :

Code

TLE test case : https://cses.fi/file/3d5f25fa10486d5059bfe87f28554e8fa18d9e0f1f1d6f27f3d3f3d324ab45f0/1/1/

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

https://www.hackerrank.com/challenges/cloudy-day/problem

Stuck for 2 hours

can someone explain how to solve this question in a simpler way.Couldnt understand the editorial.

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

In the standard coin exchange problem were each denominations are available infinite times and we need to find the number of ways in which we can form the target value :

for a recursive function int fun(int n , int val) and the arr contains the denominations.

this is how the possible cases for the recursive calls should be .

Spoiler

But before seeing the solution I thought it like this instead ( definitely wrong )

Spoiler

I considered one more case too, where we take the coin and move to the next index . I cant find a reasoning why this is wrong logically .

Might be a stupid doubt but cant get over it just like that. Can anyone tell me why is it wrong to consider that case.

Thanks

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

Can someone tell me whats wrong with my code

https://www.hackerrank.com/challenges/xor-and-sum/problem

Code

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

https://www.hackerrank.com/challenges/misere-nim-1/problem?isFullScreen=false Trying for 3 hours straight. Can someone explain how to solve this problem.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

https://www.hackerrank.com/challenges/bear-and-steady-gene/problem

Can someone please explain why my code is not passing some test cases.

Code

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By mkmeden, history, 2 years ago, In English

https://www.hackerrank.com/challenges/tutzki-and-lcs/problem

I ve been trying to solve this for hours and could'nt find any understandable online solution, Can anyone explain the logic and code behind this problem.

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By mkmeden, history, 3 years ago, In English

https://codeforces.me/problemset/submission/377/143943114

Can anyone help me why i am getting TLE in this code at the 10th TC.

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

By mkmeden, history, 3 years ago, In English

Hello,

https://codeforces.me/problemset/submission/1335/138670454

Can anyone explain why my submission is giving a RUNTIME_ERROR exit code: 2147483647, checker exit code: 0, verdict: RUNTIME_ERROR?

It works correctly on my linux terminal.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it