arya5691's blog

By arya5691, 12 years ago, In English

Hi,

I am unable to understand the solution for the following problem : http://codeforces.net/problemset/problem/255/E

I understand that we have to calculate the Sprague Grundy values for all numbers uptil root( 777777777777 ) = 881917. Then these values need to be used to calculate the function values for the number of coins in each of the piles, and these need to be XORed. If this final value is zero, then Rublo wins; else Furlo wins. I hope that my understanding is correct.

If yes, then how do I go about calculating the Sprague Grundy values ? I know that I need to find the minimum excludant of the function value for all the possible y values that can be reached from the current x, but I am not sure how I should do this efficiently.

The editorial says : "Grundy function is very small, you can start on the partial sums for each type of function that would quickly tell what function is in the interval, and which are not present. Knowing the answer is not difficult to find small response for all piles."

I am afraid I am unable to understand this. Could someone please elaborate ?

Thank you :)

Full text and comments »

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

By arya5691, 12 years ago, In English

Hi,

I coded the following solution to Problem H of Round #145 Div 2 — Merging 2 Decks :

Solution Link : http://codeforces.net/contest/234/submission/2418169

Problem Link : http://codeforces.net/contest/234/problem/H .

When I submit this solution, I get the message "Runtime Error on Test 1". However my program runs properly for test case 1 locally, as well as on IDEONE. Does anyone have any idea what the problem could be ?

Also, I submitted a solution using a Try Catch block to catch any Runtime exception, and I am printing the Stack Trace to STDOUT.

( Link : http://codeforces.net/contest/234/submission/2418290 )

However, now I simply get Wrong Answer on Test Case 1 and I can't see what exactly my program is outputting :( Does anyone know any workaround to figure out exactly what's wrong ?

Any feedback would be much appreciated! Thank you :)

Full text and comments »

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

By arya5691, 12 years ago, In English

Hi,

I was trying to solve problem 221C from Codeforces Round #136 Division 2 ! ( http://codeforces.net/contest/221/problem/C ) and the approach that I am using is to simply sort the array, and then compare it with the original for mismatches.

When I submitted this code by checking JAVA7, I got a Time Limit Exceeded, but when I submitted exactly the same code by selecting JAVA6, it got accepted. Any idea why ? Any insight into this would be most appreciated since I am very confused.

JAVA7 SUBMISSION : http://codeforces.net/contest/221/submission/2362232

JAVA6 SUBMISSION : http://codeforces.net/contest/221/submission/2362234

Thank you :)

Full text and comments »

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