eigenvalue's blog

By eigenvalue, history, 2 months ago, In English,

I am trying to solve Problem M: Counting Marbles. I am writing an editorial in case somebody might need it after me, and I am also trying to ask for help in spotting the error in my code.

Editorial:
We are essentially trying to write the smallest base-365 number with the marbles. So we must minimize the earlier digits as much as possible.

Use a priority queue with the tops of the stack, and whenever you use a marble, remove it from the priority queue and put the next element in the queue instead. Please see my solution for one such implementation.

Help: My solution is able to run on the sample test cases, but I'm getting WA (could somebody take a look at this)?

My solution: https://www.ideone.com/VnKScW
Problem Statement: http://codeforces.com/gym/101889/attachments/download/7471/statements-2017-latam-regional.pdf

EDIT: This editorial is incorrect.

Read more »

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

By eigenvalue, history, 13 months ago, In English,

Hi codeforces,

I was attempting to solve the KMP problem below, but I'm failing on testcase 3.When I run the testcase locally, I am getting the correct answer on my machine. Could somebody help spot the bug that is probably causing undefined behaviour?

Problem: http://codeforces.com/contest/471/problem/D Solution: http://codeforces.com/contest/471/submission/31585259

Read more »

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

By eigenvalue, history, 2 years ago, In English,

I have been trying to solve the problem Nudist Beach, here at http://codeforces.com/contest/553/problem/D. However, I find that when I submit I get a different output as that from ideone, or my local compiler. Even more strangely I get different results depending on whether I submit the file, or whether I copy-paste the code into the editor.

When I submit by file, I get a response of WA on the first testcase. When I submit by copy-paste, I get time limit exceeded. When I run the same code in ideone, or my local compiler, for the first testcase, I get the correct output instantaneously.

Please find attached the following code-links. Ideone link. http://ideone.com/INKqhS. WA submission link. http://codeforces.com/contest/553/submission/19136417 TLE submission link. http://codeforces.com/contest/553/submission/19136401

Is this an error in the compiler/judge, or is it at my end? Thanks for taking a look at this.

Read more »

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