amankp7's blog

By amankp7, history, 3 years ago, In English

After practicing leetcode and gfg and giving contest on the same. I decided to come back again to codeforces and codechef and today was CodeChef Starter 97. My friend who set up the contest suggested me to participate in the contest and I went for it. Solved A in 3-4 mins an easy sliding window question.

Then comes the B of Div 2: I gave thought to the question and found the logic. I immediately wrote the solution and submitted it, and this is what happened

I got TLE. After debugging and thinking about the time complexity of the code, I found that the code was completely fine and should be accepted after wasting one and a half hours during the contest. I implemented the lower_bound by myself, and it got Accepted. And I was like, WTF!!

After the contest, I talked to my friend absolute-mess, and he submitted the same code, and guess what? The same code got Accepted.  CodeChef was high during the contest

This was not expected in the running contest. Disappointed with CC. How Codechef will justify this sh*t!!!!

My submission : My Submission

Sanskar's Submission(Same code) : My Friends Submission

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

| Write comment?
»
3 years ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

Don't know why so many downvotes, I faced similar issues before. One code got tle, but the same code got ac after some time. It wasn't even from a running contest. One of my seniors said he got tle for using a loop for 5 iterations, but using 5 if/else got ac XD

  • »
    »
    3 years ago, hide # ^ |
     
    Vote: I like it -10 Vote: I do not like it

    Exactly, I'm also not able to process the number of downvotes :|

    • »
      »
      »
      3 years ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      I faced a weirder problem. At a codechef contest (also prob B) the constraints said that 2 <= N <= 2e5. submitted the my solution and got WA. I made another couple of solutions and I got another WA. I solved C and D then Used the same solutions twice and handled if N == 1 it got accepted :D. (I wasted 15 minutes and got 2 WA ). I posted on the daily codes discord server and someone submitted the same code after the contest and got Acc :D.

»
3 years ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

based judge

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Yes, even I felt that the constraints were a little tight for this problem.

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Feels bad.

»
3 years ago, hide # |
 
Vote: I like it +19 Vote: I do not like it

Even the accepted solution is dangerously close to the time limit. You have to use fast IO and '\n' instead of endl. Your IO overhead is huge. This is not codechef's fault.

https://www.codechef.com/viewsolution/99862712

Your own solution with fast IO passes in 1/3rd of the TL.