On 1763B

Revision en1, by shevlopmes, 2022-12-19 20:21:11

Hello everyone, Im Maxim and Im kind of a beginner in programming. Today I took part in the CF Round #840 (Div. 2) and faced some serious problems with problem B. At the beginning, I wasted around 20 mins and 1 submission because Id misread the statement. But its not interesting. Then I wrote what seemed to be the correcrt solution, but it got WA2. I looked for mistakes and wasted another 2 submissions (and another 30 mins), but the code remained quite the same. Then I decided that a machine finds mistakes better than I so I wrote a brutforce solution. I strategically submitted it and, of course, got TL5. But it passes the second test! I was excited. Finally I can write a random stresstest and find the bug. I ran it and it found nothing! I was shocked. But I decided to fight till the end, so I made up the trick: ~~~~~ if(n<=20) ans = brute(n,k,h,p); else ans = solve(n,k,h,p); ~~~~~ Of course it is a bad solution because it gets TL on some particular tests. But I felt like a casino player who goes all in. And it passed pre-tests. But it was too late, because by that moment I have wasted 90 mins and sent 5 wrong submissions. So I knew that I anyway will get negative delta and felt kind relaxed. And, to my surprise, my submission passed the final tests! So, if you have faced the similar problem with test 2 or just have some valuable advice, please be welcome in the comment section.

Tags codeforces round #840, 1763b, bugs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English shevlopmes 2022-12-19 20:22:06 9
en2 English shevlopmes 2022-12-19 20:21:39 16
en1 English shevlopmes 2022-12-19 20:21:11 1427 Initial revision (published)