1guptagaurav's blog

By 1guptagaurav, history, 2 months ago, In English

During today's Div2A contest, I encountered an issue with one of the questions. I wrote the expression ceil((n) / (c * 1.0)), which gave me a wrong answer on the second test case. This was really frustrating, and it ended up ruining my performance in the contest. After the system testing, I discovered the issue: the output format expected an integer, but I got something like "1e+009" instead. That’s when I realized I needed to cast the result to long long. Once I updated the code to (long long)(ceil((n) / (c * 1.0))) after the contest, it worked and got accepted.

During the contest, I was wasting time trying to find the problematic test case, when the real issue was my misunderstanding of the built-in functions. This experience taught me how important it is to fully understand the functions you're using. Today, I realized that participating in contests teaches you a lot, even if things don't go as planned.

[contest:2013][problem:2013A]

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

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

I have a couple of things to say about this. First of all, absolutely great turn-around of mentality. I saw your post earlier and comment on giving up CP and whatnot out of the frustration and difficulty. It is not easy to rid of that mentality and then focus on how to improve. I commend you for that genuinely. Second, it is absolutely true that contests are not just simply "tests" or evaluations of your skill. They themselves are a form of practice and it is alright to fail on them even for stupid reasons, as long as you look to improve and learn from it. Third, realize that there will be many more frustrating times later on, but do not quit. Keep learning. The point of CP is not to reach the top and boast about your strength. It is to continually learn and get better for yourself. We all do something as "weird" and "unenjoyable" (to other people) as CP because we value it. So stick with it.

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

    Yes. I believe the same. Keep failing and learning from failures but never give up what you want to achieve.

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

(n+c-1)/c is more recommended, though.