CodeSherlock's blog

By CodeSherlock, history, 4 years ago, In English

Hey Programmers, Hope you all are safe and doing well.

I am a beginner in DP, and while solving the atcoder dp series, Problem K (Stones) , I am not able to pass all sets of test cases. Also this I am not able to analyse whether its a DP or greedy problem.

Here is My Solution :.

My Logic : If we can reduce the no.of stones(k) to something where the opponent cannot make a next move, I win. Else I simply reduce the min no. (mn) of the given array from the no.of stones.

Can you please clear my confusion ? It will be helpful if you can point out the test case...where my solution goes wrong. Thank You.

Full text and comments »

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

By CodeSherlock, history, 4 years ago, In English

Hello everyone !!! Hope you are doing well...

I am new to graphs. While solving some problems with some basic problems related to traversals, depths etc, I found that the compilers both in my PC as well as Codeforces throws an error in most of the times when I use the visited or depth vector instead of a simple array. [ "vector visited(n)" instead of int visited[n] ] even though the logic is absolutely right...I get "Out of Bounds !!!" error.

On solving 115A - Party, My two solutions gave the same errors on Test case 30 & 31. 81687022 & 81687992

Well I simply changed the Vector to Array and bang...Accepted !!! 81688553

Can you please help ???

Full text and comments »

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