vamaddur's blog

By vamaddur, history, 7 years ago, In English

http://mirror.codeforces.com/contest/145/submission/28183892

I keep missing Test Case #58 on this problem because my answer does not have enough elements. Does my program RTE before printing out the last 2 elements, or is my IO flawed in some way that prevents it from reading in the last few queries?

Please help, and thanks in advance! vamaddur

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

»
7 years ago, # |
Rev. 2   Vote: I like it -8 Vote: I do not like it

Why the downvote? I am asking a question for a PAST CONTEST not a CURRENT CONTEST. This is perfectly fine, so I see no reason to push the button.

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

    People tend to downvote post that ask question(they think is not meaningful) that's why. I can assure you that if you are asking a question for a current contest, your downvote would be 3 digits. Anyway, the problem is the size of your stuff is too small. Increasing it will give you TLE on test 80. Here you go. 28189330

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

    Further improving IO speed gives you AC. 28189632

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

Why does changing the size of "stuff" change the behavior of my code? The size is already 1000000, which is enough to hold any string that is given...

EDIT: Perhaps the newline character??? But why would this cause my code to miss two queries?

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

    yes, it is the newline character, and that causes UB. So I don't know how it cause your code to miss 2 queries.

    EDIT: I don't mean the newline, but the \0 character. Sorry, wasn't paying attention when I reply.