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

Автор rgrg4, история, 3 года назад, По-английски

Sometimes we have a good contest while in others we don't perform well. Just to lift your mood can you people share some funny incidents that happened with you during your competitive programming journey

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

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

Codeforces Round 694 (Div. 1)

I submitted B at 00:25 (103410744), pretests passed, 1998/2000 ms.

At 00:30, I decided to replace all long long with int and I resubmitted, TLE on pretest 3.

I moved to C, I got pretests passed at 01:33.

I checked the standings. It turned out that D was much easier than C, and it was worth 500 more points. I was unable to solve it in the remaining time.

I failed system tests on B (TLE on test 7).

After system tests, I resubmitted B with int, still TLE on test 3.

A moment later, I realized that there's $$$w \leq 10^{18}$$$ in the input ($$$w$$$ was quite a useless variable, since every query with $$$w \geq 1$$$ had the same answer regardless of the value of $$$w$$$).

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +22 Проголосовать: не нравится

    You should learn about the linear prime sieve

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      For some reason, I thought that the bottleneck in my code was the map of vectors, not the factorization.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    In the same contest, when I solved problem B I saw that most people re solving C so I started solving it. When I finished, I saw D was solved twice as C so I said That I could've gotten much more points solving D and I was sad. An hour later, C failed system testing. Thank god there's no "Deactivate Codeforces account" button.

»
3 года назад, # |
  Проголосовать: нравится +161 Проголосовать: не нравится

I got a wrong answer in contest only because i forgot to remove cout << "hi" 99846875

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +24 Проголосовать: не нравится

    Is there a reason people don't use cerr, I don't see it a lot in people's code

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится -10 Проголосовать: не нравится

      You mean for debugging?

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +14 Проголосовать: не нравится

      Yes. It is flushed whenever you use the << operator, as unitbuf is set. This is basically like endl whenever you do cerr. That's why its sometimes not good for runtime to use cerr.

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

        Yes, it's not good to use cerr in runtime, but that's not the only usecase. Usually I use cerr for debugging and comment it just before submitting the solution. But if I accidentally forget to do that, there's high chance the submission passes TL and doesn't yield WA.

»
3 года назад, # |
  Проголосовать: нравится +77 Проголосовать: не нравится

I once spent an hour figuring out what was giving me WA. Turns out I had written a-=min(a,b); b-=min(a,b) ignoring that value of a was getting changed in my code. Lesson learnt!! :weep:

»
3 года назад, # |
  Проголосовать: нравится +228 Проголосовать: не нравится

Once I wrote #pragma GCC optimize("Ofast,untroll-loops").

The trolls are definitely gone.

»
3 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

In codeforces round #698 I submitted 5 wrong answers for B. My first submission was at 00:31 and my Accepted solution at 1:14(with a minus of 250 points for Wrong Answers). The example test case had the value of d(which was the input) as 7. So while writing my code instead of using d I used 7 everywhere instead. All my example testcases passed because of this but got WA at testcase 2. It took my half an hour to realize that I needed to replace 7 with d. Here is my incorrect solution — 105742575

»
3 года назад, # |
Rev. 3   Проголосовать: нравится -27 Проголосовать: не нравится

#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

In a contest i wrote IOS after cin>>t . My code was working fine locally but was giving wrong answer on some pretest. I moved IOS before cin>>t and it worked . Does someone know why it was actually causing the error ?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +7 Проголосовать: не нравится

    Lol, cout.tie(NULL).

    • »
      »
      »
      3 года назад, # ^ |
      Rev. 6   Проголосовать: нравится 0 Проголосовать: не нравится

      Even i removed cout.tie(NULL) , I am still getting wrong answer if i use IOS after cin>>t , submission

      Why Lol ?

      Also people who downvoted the comment above , may i know the reason ? If you provide feedback then i will ask my doubts next time with more care .

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится +5 Проголосовать: не нравится

        If this function is called after I/O has occurred on the standard stream, the behavior is implementation-defined: implementations range from no effect to destroying the read buffer.

        Reference

        • »
          »
          »
          »
          »
          3 года назад, # ^ |
          Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

          Thanks a lot . Also i am happy that unlike above person you didn't trolled and helped me instead . Thanks :)

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится +21 Проголосовать: не нравится

        cout.tie(NULL) does literally nothing because cout is already tied to NULL.

        In general I think people should read the documentation for such things instead of just pasting them "because it makes input faster". This would also have prevented your confusion here because the documentation tells you that the effect of calling that after reading input is implementation-defined.

        Also people who downvoted the comment above , may i know the reason ? If you provide feedback then i will ask my doubts next time with more care .

        I think you got downvoted because this was supposed to be a thread for sharing funny stories. Your story wasn't very funny, it was more like "asking a queston".

        • »
          »
          »
          »
          »
          3 года назад, # ^ |
            Проголосовать: нравится +2 Проголосовать: не нравится

          I think you got downvoted because this was supposed to be a thread for sharing funny stories. Your story wasn't very funny.

          I remember it was at 0 votes before you replied.

        • »
          »
          »
          »
          »
          3 года назад, # ^ |
          Rev. 8   Проголосовать: нравится -48 Проголосовать: не нравится

          My question wasn't on asking advice like what i should do before making a template .

          I already knew that cout.tie(NULL) doesn't helps in making things fast (I read that in a blog on codeforces) . I made the template long back and didn't had any reason to change it . So why Lol in it ? I can tell few red coders still using cout.tie(NULL) . It's on me to change something or not .

          I think you got downvoted because this was supposed to be a thread for sharing funny stories. Your story wasn't very funny, it was more like "asking a queston". When a contest announcement blog is made but people also discuss problems there.

          I thought my mistake was funny and i asked people how it was wrong at the same time .

          Did you really Laughed Out Loud after reading my comment ?

          You have contributed to community a lot (through some interesting blogs) . Thanks for that . But i want to tell that i have seen you quite often making lol and similar comments on peoples silly mistake (usually low rated). I find it very bad thing tbh .

          Also as EnterYourName said, i also saw that i had zero votes till you didn't replied . I don't know if you downvoted (since high rated users have more voting power) or lot of people downvoted but it was mostly due to your LOL comment .

          Thanks anyway to both you and EnterYourName for Discussion . I agree with your point that one should read documentations and should not make off topic comments but that could have been told in first comment itself .

          • »
            »
            »
            »
            »
            »
            3 года назад, # ^ |
              Проголосовать: нравится +3 Проголосовать: не нравится

            Why do you even care about upvotes/downvotes?

            • »
              »
              »
              »
              »
              »
              »
              3 года назад, # ^ |
              Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

              Yeah you are right . Contribution on codeforces doesn't actually represent how much person is really contributing .

              My both comments aren't that bad to get that much downvote .

            • »
              »
              »
              »
              »
              »
              »
              3 года назад, # ^ |
                Проголосовать: нравится +1 Проголосовать: не нравится

              Comment #1 Comment #2

              Yeah. Why should someone even care about upvotes/downvotes? They could either play it off by saying "Oh I'mma get downvoted".

              • »
                »
                »
                »
                »
                »
                »
                »
                3 года назад, # ^ |
                  Проголосовать: нравится 0 Проголосовать: не нравится

                It seems that apparently I was correct.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 года назад, # ^ |
                    Проголосовать: нравится +1 Проголосовать: не нравится

                  Yeah. You're the guy that says "I'm not a racist" and then make some racist joke.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 года назад, # ^ |
                    Проголосовать: нравится 0 Проголосовать: не нравится

                  So many people cheating from a particular country in almost every contest,so who was to blame then? Don't give me that shit:"Most Indians are not not cheaters bla bla bla...". Even many Indians themselves accepted that it was the problem of their country.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  3 года назад, # ^ |
                    Проголосовать: нравится +1 Проголосовать: не нравится

                  I don't wanna beat around the bush.

                  Everyone does care when they're downvoted.

        • »
          »
          »
          »
          »
          3 года назад, # ^ |
            Проголосовать: нравится +3 Проголосовать: не нравится

          This should have been your reply in the first place.

          • »
            »
            »
            »
            »
            »
            3 года назад, # ^ |
            Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

            This should have been your reply in the first place.

            That's true . And i actually didn't asked about what he answered . Instead this reply was on-topic with my comment. But instead he has got higher votes than that person.

            Thing is i didn't got down-voted by lot of users , but by few high rated users (High rated users votes have more absolute value).

            • »
              »
              »
              »
              »
              »
              »
              3 года назад, # ^ |
                Проголосовать: нравится +8 Проголосовать: не нравится

              Instead this reply was on-topic with my comment.

              Despite being its helpful, It somehow got downvoted than earlier lol.

              I'm sick of these irrational guys but gotta take it for granted.

»
3 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

100954176 I put a break before reading the entire input in a multitest problem. It took me half an hour after the contest to realize the mistake.

»
3 года назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

In round 689, I got WA on a problem because of forgetting to print a newline in one of answers of the edge cases. 100942496

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This happens quite often with me. I solve a question with answer as "YES" or "NO". It works fine on my system, giving all the answers correctly. But when I upload it, I get wrong answer. I spend a lot of time figuring out what is wrong with my algorithm, change my code in varied ways, only to realize at the end that the problem was with the way I printed yes and no.

»
3 года назад, # |
  Проголосовать: нравится -29 Проголосовать: не нравится

Seeing poor performance at my end, I left a contest midway to do otherwise unimportant work. When I resumed after returning, I failed to submit E due to the shortage of a few seconds. Sed Lyf

Thankfully this only happened during a virtual contest xP Lesson Learnt!

»
3 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

In Codeforces Round 594 (Div. 2), I forgot to use long long in both the div2A (62980149) and the div2B (62990647), went grey because of that D:

Also my solution for Good Bye 2020 E passed in 1996ms for a 2000ms TL, the same code passed in 600ms using C++17 (64)

»
3 года назад, # |
  Проголосовать: нравится +36 Проголосовать: не нравится

Umm... before educational round 103, I made some changes in my template or better say I changed

#define ll long long int

to

#define ll int

I ended up making 10 wrong submissions for problem B and realised the mistake after checking my template.

P.S. Don't code while you are drunk.

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

I solved only one Question in last educational round and that too someone hacked.

»
3 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

I submitted B in place of C and lost points... :P

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

When I was participating in the first contest of my life, I didn't know that the difficulties increase so much, so when I couldn't solve the easier problems, I opened F thinking that maybe it would be easier than the previous problems. But obviously, I didn't even understand the statement.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    How many problems you solved before participating in your first cf round?

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    why is this funny ? This sounds more like a flex tbh,

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      No flex . He is really good . He achieved red in 2 years which most people achieve in 4-6 years . Don't be jealous of him . Most of the comments in this blog aren't funny tbh and this blog title and description don't align .

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +35 Проголосовать: не нравится

      this was fuuny actually that a person can't solve d but was trying E and F

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Yeah that was the joke. It sounded like a flex because I mentioned "first contest", but anybody would do such a mistake in first few contests only.

        • »
          »
          »
          »
          »
          3 года назад, # ^ |
            Проголосовать: нравится -8 Проголосовать: не нравится

          I did something similar in the last one. Couldn't crack E, tussled with F despite seeing 0 accepted submissions on it (too naive in hindsight). Didn't fathom it'd be rated 3000 even after being thrashed in the face by vain attempts, LOL.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    so you are saying that even after solving 200 questions and possibly knowing from your peers / seniors that difficulty increases in cf contest, you thought that E and F were easier.... thats hilarious!!

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +5 Проголосовать: не нравится

      The funniest part in this thread is your username.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I only solved easy problems from a2oj ladders, I didn't know anything about levels, divisions or ratings.

      You can actually check my earliest submissions, at least 150 of them are only from a2oj ladders.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +4 Проголосовать: не нравится

      okk I can see your jealousy to him,Its common bro that a guy cant know about difficulty,200 qsn didn't justify that he should know about codeforces....

      Why judging him so much ,,Oh! cause u havn't guts to reach the level at which healthyUG is...

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        I am not disrespecting anyone, i have seen his videos and he is doing a great job, and i would try to reach his level even if i cant , i was just curious about how he practiced before CF which he clearly stated in the comments

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    demoralizer massive respect man !!
    Coincidently we are from the same city !!
    mile kabhi VT pe :-p

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится
  1. if(a>b)?cout<<"Yes":cout<<"No";
  2. int i,j,n,m; for(i=0;i<n;i++) { for(j=0;j<n;j++) { } for(i=0;i<m;i++} { } } Figuring out why program is running for so long time(infinite).
»
3 года назад, # |
  Проголосовать: нравится -20 Проголосовать: не нравится

Replacing endl with "\n" got me from TLE to AC.

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

I once wrote for (int i = 1 ; i <= n ; n++) and it took me 30 minutes to debug

»
3 года назад, # |
  Проголосовать: нравится +61 Проголосовать: не нравится

I once wrote #define ing long long in my school's contest and spent 30 minutes trying to figure out why I got Wrong answer on test 3.

»
3 года назад, # |
  Проголосовать: нравится +47 Проголосовать: не нравится

During a contest, I attempted at solving problem E because it felt easier than a usual E. I didn't realize that I was trying E and submitting on D :( I didn't realize it even after the contest ended and was trying really hard to debug and find what's wrong. 1-gon Monogorz helped me find the bug :clownglasses: :ghosthug:

Untitled

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I got a tle in one solution because I was using long long int instead of int

»
3 года назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

Rookie here. In my first div 3 contest, I happily solved problems A and B and submitted the code at around 00:15 but got CE. Spent 40 mins trying to find the bug but still failed. Turns out that I selected the wrong language. Dang.

»
3 года назад, # |
  Проголосовать: нравится +120 Проголосовать: не нравится

I once implemented two segment trees to find minimum and maximum element in the range related problem of the array. It was a sorted array (-_-)

»
3 года назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

1) Once, I had pretests fail just because I forgot to print "new line" on a corner case.

2) Once, I had pretests fail on a 1900 level problem (hardest in-contest problem) just becuase I forgot the case of 1.

3) Once, I had system-tests fail because I forgot to return m on a corner case.

4) Once, I had system-tests fail because of long long issues.

5) In the most recent contest, I spent 3 minutes of A, 30 minutes (ish) trying to solve B, then looked at C & solved it. After solving C, I finally figured out how to solve B, but I ran out of time. It turns out my A solution was hacked because of some dumb errors, so in teh most recent contest, I only solved question C.

6) Once, I accidently submitted problem D to the problem C slot, hence making me lose 50 more delta than before.

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

My solution got hacked because I used ceil(). Though, I learnt a lesson that I won't do this mistake in future.

»
3 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

Once I was returning the answer even before taking the whole input....RIP

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

In vector I made assigned values like v[i] = a, instead of v.push_back(a) in D problem. This was the only mistake in my solution during contest.

»
3 года назад, # |
  Проголосовать: нравится +185 Проголосовать: не нравится

found this once Codeforces Dual

»
3 года назад, # |
  Проголосовать: нравится +50 Проголосовать: не нравится

Once I got wrong answer on test case 149.I thought that I may be missing some edge case. But eventually it turned out that my whole logic was wrong but still it was able to pass 148 test cases.

»
3 года назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

Once i got wrong answer just because i have printed "N0" instead of "NO" . https://mirror.codeforces.com/contest/1388/submission/88469165

»
3 года назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

In a contest, I failed a system test just because my code was printing 1e12 instead of 1000000000000 :\ sed lyf...

»
3 года назад, # |
  Проголосовать: нравится +42 Проголосовать: не нравится

Codeforces Round #470. It's my first contest, I'm getting ready, I've been solving problems for a year now and I'm ready to get these problems solved. The contest started and I have no clue why the problems are that hard. I've read A, B and C and didn't have any idea so I moved to problem D and I thought I can solve this one.

One and half and hour has passed and I finished the code but I couldn't submit because I didn't register to the contest. Oh god, I'm in Div.1! I moved to Div.2 so quickly and solved problem A and started finding problem D in the Div.1, which was problem E in the Div.2, I got a wrong answer (obviously) and A didn't passed system testing. My university's coaches laugh at me until now, although my code had a bug and I solved it after the contest.

Don't code problem D Div.1 when you can't solve A Div.2.

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

In 2018, during the last phase of the Brazilian OI, I forgot to put the '\n' in one of my printfs in a segment tree problem, I tested the cases and everything seemed fine, because it hadn't reach the if that contained the bad printf. The contest was blind, so I ended with 0 points on that problem, thus not reaching the Team Selection Phase for IOI.

»
3 года назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

This took my whole morning : D

for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++i)
        do_something_with(i, j);
»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

In the cf edu round 103 for problem B i wrote a correct code within 15 mins but I overwrote it on solution of A and wasted like more than 25 mins to find the bug. I had written the code for A in test_case() function but for B i wrote in precompute() function without erasing solution of A. Lol.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Just a tip if you (or someone else) uses vim, you can use :u0 to restore the file to it's initial state at the time of opening. You can do that and start doing the next problem with a clean slate.

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

once I used the same iterator variable inside a nested nogic, almost went mad debugging!

for (int i = 0; i < n; ++i){
    for (int j = 0; j < m; ++j){
        // somestuff
    }
     //again somestuff
    for(int i = 0; i < k; ++i){  // here I again used i as the for loop iterator
          
    }
}
»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I secured 179 rank in CF round #692. Particularly because I did B problem very quickly. But when my friend asked me about the reason I used brute force to solve it, I was dumb and just said strong intuition made me write a brute force.

A few contests later, I secure 6086 rank in CF round #698, where I couldn't solve the B problem. But ironically, the way my friend solved the same problem was strong intuition and brute force only and he was unable to state a proof to it xD. The same condition like a recent problem but roles switched!

»
3 года назад, # |
  Проголосовать: нравится +30 Проголосовать: не нравится

Submitted in the wrong problem and got "Wrong Answer on Pretest 2".

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

Well this happened to me in some atcoder ABC a while back...I had to print Takahashi in some problem as answer but I was printing Takashi. Costed me some reasonable amount of time :(

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

Once I've wrote two different ok solutions for this 987E - Petr and Permutations problem only to realize I was misspelling Um_nik with Um_Nik. Always read the statements!

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

I did an oopsie in Codeforces round #700 div2/B. Instead of "<=" I used "<" and pretests were passed during the live contest but gave WA after system testing. Sed lyf I guess :(

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I started Quora Programming Contest Div 2 (actually it is just round 2) late by 50 minutes. I thought it started at 10 am local time when it is actually 9 am.

In the last few minutes I was fine-tuning some weights for an ML task and luckily got into top 50 for the shirt.

I learnt to never give up :P