Himitsu's blog

By Himitsu, history, 6 years ago, In English

Hello,

I am solving this question and it is failing in test case-3.

The test case is as follows:

8 2

Link to submission: http://codeforces.me/contest/1072/submission/44671042

Output on my terminal(on running the same code) is coming as the correct answer but judge is showing some other output.

I have no idea why this is happening. Can someone help? Thank You

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

| Write comment?
»
6 years ago, # |
  Vote: I like it -12 Vote: I do not like it

I don't mind the downvotes but can someone atleast tell me what I am doing wrong? or is downvoting without any reason the only thing you people(to the downvoters of this blog) are good at?

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

    Main issue is the size of ar — in that testcase, it's 1, and ar.size()-2 as an unsigned integer is something very large — much larger than the size of your vector (ar.size() is unsigned). In general, if you really need to use something.size(), I suggest typecasting it to a signed integer first, to avoid stuff like this happening.

    As for why it works locally, look at your compiler settings — those are most likely different from what is being used on the judging server. When I compile your code, for example, I get several warning messages from your macros about comparisons between signed and unsigned integer expressions.

»
6 years ago, # |
  Vote: I like it -21 Vote: I do not like it

LoOoooLoOoOooooLoOoOoOooOooOL. ROFL. LMAO. Are you sure you are even a C++ programmer? Or are you just a code monkey? Maybe there is a ghost in your/codeforces compiler after all. XD.

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

    Looks like that you're out of blogs to spam on. This one is from 7 weeks ago XD