TheOpChicken123's blog

By TheOpChicken123, history, 16 months ago, In English

I have made the same mistake twice now...

Wondering what the mistake is? Well it is using a set instead of a multiset. I made this mistake in the last contest of 2022, which almost cost me the chance to become expert by the end of 2022. And now, i made it again in the first contest of 2023, and, will likely lose me expert status because of it.

I am kicking myself over this... Howwwwww,.. whyyyyyy....

Anyways, hopefully i will learn from this mistake and never make it again.

I also advise everyone reading this blog to always consider whether to use multiset or set as it can be the difference between AC, and WA. oftentimes, there is only one right answer.

Also, it is very important to not make a habit of using one over the other. This is the main reason i made both the mistake. I have never really needed to use multiset in my life. On the other hand, I use set quite frequently. This is why I had a habit of using set and not multiset and i didn't even think about it.

Hope everyone has great contests in 2023!

Actually no, please do shit so I can gain more rating points.

UPD: I only lost 4 rating points! I'm so glad that I didn't lose my expert status although I am very surprised that I only lost 4 points. I thought I would lose at least 30 or so rating points so I am very happy!

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

| Write comment?
»
16 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Well, that's stupid, of course, but doesn't hurt as much as using unordered_set instead of just set (when time complexity allows it, of course).

So imagine you realise that you only need O(1) access, you decide to use unordered_set, and you get hacked by this stupid shit: https://codeforces.com/blog/entry/62393

Although, O(log(n)) would also be allowed, and you could've used a standard set. Because of this crap in the blog post above, I'm now scared to use unordered_set.

  • »
    »
    16 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    well, i have actually been hacked for using unordered_map and unordered_set too many times, trust me. That's why I have never used unordered_set or unordered_map again in my life. Nowadays, my default is either to use map, or set, and if my solution is too slow, then I try changing it to unordered_set or unordered_map, mostly because Im so scared of getting hacked.

    • »
      »
      »
      16 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Java users when they try to sort arrays using Arrays.sort (it uses quick sort)

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    This is exactly the reason why I have a copy-paste hash function that I always use with unordered_mapand unordered_set.

  • »
    »
    16 months ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    If you read the blog, it tells you what to do in order to not get hacked. So why are you scared?

»
16 months ago, # |
  Vote: I like it +49 Vote: I do not like it

I am doing competitive programming for almost 15 years. I still overflow ints occasionally. Also, at the end of November I caught several TLEs because I printed a couple of millions numbers using cout without ios_base::sync_with_stdio(false)

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Wow. Good to know that even the best make silly mistakes :)). But im salty because the last one you made was at the end of November...

»
16 months ago, # |
  Vote: I like it +30 Vote: I do not like it

I lost F today because "herp derp if I minimize the answer then I don't have to think about anything" introduced a bug in my code.

I got 3-4 WAs in the contest before this one because I typed = instead of += when taking the sum of things in a subtree.

Shit happens. I'm a bit salty that literally the fucking last test got my solution in today's F. Don't get me wrong, good job by the testers/setters to make a test that catches such stupidity, but it being the literal fucking last test makes it hurt a bit more.

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Wow ur second problem has to hurt. I remember making a similar mistake a few times and its so annoying because its the tiniest mistake and therefore its so hard to spot.

    Unless you read every line and every character of your code its almost impossible to find the error.

»
16 months ago, # |
Rev. 3   Vote: I like it +10 Vote: I do not like it

My two worst mistakes:
- In this problem,I thought that the move is between two adjacent towers only!
- In today problem ,I thought that multiply an element by -1 at index<m which has prefix[index] <prefix[m] will increase this prefix only, how stupid I am!

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Oof. The worst types of mistakes (in terms of costly the mistake is) are mistakes in your understanding of the question or in your logic.

    In this contest itself I had misunderstood question B and i thought that the sum of any pair a[i] + a[j] = the sum of the whole array when it is actually just all adjacent pairs a[i] + a[i+1].

    Its so costly to make this mistake cos if you write the code to answer the question (or what you thought was the question) then you will waste both valuable time and many resubmissions not doing anything useful at all.

  • »
    »
    16 months ago, # ^ |
    Rev. 2   Vote: I like it +35 Vote: I do not like it

    The first mistake is funny, because the problem was supposed to be like that. BledDest initially wrote the problem with only adjacent moves allowed and told me to prepare it. I didn't notice the word "adjacent", still agreed with the difficulty and prepared it like you see it now.

    When we discovered the mistake (when BledDest looked into my solution, realized it doesn't make sense and read the statement), we just decided to keep it.

»
16 months ago, # |
  Vote: I like it +3 Vote: I do not like it

https://codeforces.com/contest/1717/submission/170634783

Specifically, this one Python line:

arLen = max(n+k)+3 #array length

For context, n and k were int values. Normally there would be something to learn from a mistake made in a contest, but I mean, how do I even explain messing up the syntax for max() in python.

There was also the "I can't count to five" incident I had earlier in 2022. Let's just say debugging is important in programming as a whole.

»
16 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Well in yesterday's C I had a lot of stupid typing mistakes(such as '+=' to '+'), which cost me a whole 8 submissions and a lot of precious time.

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yea that's painful. 8 submissions costs around 400 points doesn't it?

    • »
      »
      »
      16 months ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Yes exactly and I could gain around 15 rating if there isn't that.

»
16 months ago, # |
  Vote: I like it +6 Vote: I do not like it

Needing to write brute force program to find out that my answer is wrong for "LLLRRR" (0 instead of 2). How stupid am I!

»
16 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by TheOpChicken123 (previous revision, new revision, compare).

»
16 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I lost D yesterday. Didn't consider the case that if Ai=Bi, we should ignore it. After system tests I submitted with one more If statement, and it ACed. :sad:

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    oh gosh i had the same problem. Thank god I was able to figure it out in time tho :))

»
16 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I made a silly mistake too in problem B, I forget to add cout<<"YES" in my code

because there were two cases for Yes in my code. and I found this mistake in the last minutes which led me to lose points and I couldn't become a "Pupil".

I know it's not a big deal for people who has a higher rate but for me it will be a big achievement as it will be my first step to achieve something after 2 Years of CP I hope this year I will achieve this!

  • »
    »
    16 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    You arent the only one. LGMs like jiangly also made this mistake

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I actually made this mistake as well... I can't believe both of us as well as an LGM made the same mistake. It is kind of funny in my opinion :))

»
16 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Once I have spent on a problem 120+ minutes. Not very surprising, but the thing is that I had solved this exact problem a year ago before that in 10~ minutes.

»
16 months ago, # |
  Vote: I like it -18 Vote: I do not like it

You should give up.