battousai's blog

By battousai, history, 9 years ago, In English

Submission no: 11894090

Case of Fugitive of round 310 is a very nice problem, special thanks to AndreySergunin After finding solution with binary search , I was trying to solve it using segment/interval tree.

I was getting WA, Then I tested the input of test case 5 in "codeblocks : windows 7" I got same verdict as jury's but the output in codeforces compiler for my code is "No".

Dont know why, maybe somekind of gcc bug , can anyone please explain it. It will surely help to improve my coding style. Thanks in advance.

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

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

AC using GNU C++11 or MS C++, see my last submissions

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

    submit code with undefined behavior: unrated — WA, IM — AC. Coincidence? Don't think so!

    I believe that's because codeforces system detects your rating. If you're yellow or red, it will offer only big zeroed chunks of memory, and of cource no instructions shuffling.

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

      You are right! My advice is:

      STOP being blue!

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

        nay, I think it's ok to be blue

        • »
          »
          »
          »
          »
          9 years ago, # ^ |
            Vote: I like it +2 Vote: I do not like it

          Well, if your name is not written in red, you don't get:

          • increased stack size
          • lower execution time
          • shorter source code (e.g. it will be compressed)

          And many, many things!

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

There is a buffer overflow on this line:

target = mp( seg[ i ].ff.ss, 0 );

In test case 5, seg.size() == 4 N == 5.