Gravekper's blog

By Gravekper, history, 4 years ago, In English

I do stream after Codeforces rounds on twitch. Stream is mostly about discussions and Korean video editorial on problems. Sometimes I do upsolvings. Today, I was explaining about 1519D. And I found something weird in my code.

When I check even-length substrings, I started outermost iteration with A[1] and A[2] instead of A[0] and A[1]. So it does not check the case of changing first two elements. This is a shame. The code passed system test somehow, but I can't allow my wrong code got 'Accepted'.

Let's hack this with

5
5 0 0 0 0
0 5 0 0 0

Oops, elements should be larger than zero. Then this.

5
5 1 1 1 1
1 5 1 1 1

Weak tests. I mean, I'm weaker.

If you like to watch the moment of hacking, you can check the video.
(In video, I say words like "Why this passed the test?" in Korean.)

Full text and comments »

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