Блог пользователя JVirak

Автор JVirak, история, 8 лет назад, По-английски

Hey guys I had about 6 wrong submissions for this question http://codeforces.me/problemset/problem/760/B. On 4 of them I got timeout errors and 2 a wrong answer on test-cases 1. Now the contest is over I got to go over these with the test-cases visible. As usual test case 1 was the first example, which turns out to run perfectly fine on my laptop (gives right answer don't think it takes too long).

It turned out I had the same basic idea as the tutorials, figure out how many pillows it will take for Frodo to have p and then do binary search. I have no trouble believing that I made a mistake on either binary search or the number of pillows function itself (i.e. missed an edge case) which is why I kept resubmitting.

Anyway this http://codeforces.me/contest/760/submission/24047827 gives me the wrong answer on test case 1, producing 10000000 on the judge (the giant upper bound I set for my binary search). However on my home laptop it gives 2 (the correct answer). This gives me two related questions. 1. What is going on here? and 2. What does this do on other people's machines. (I'd be very grateful to anyone else willing to run it).

Also this http://codeforces.me/contest/760/submission/24048597 version of the code gives me a timeout error. Again on my local machine it manages to do the job (at least on test case 1). While I'm not sure exactly how long it takes to run (runtime output includes typing time) it seems almost instant.

Obviously I'd like to avoid this next time so if anyone can help me find this error I'd really appreciate it.

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
8 лет назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Well yeah http://codeforces.me/contest/760/submission/24047827 gives output 2 on my system as well on test case 1