Блог пользователя Himitsu

Автор Himitsu, история, 6 лет назад, По-английски

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.net/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

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится -12 Проголосовать: не нравится

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 лет назад, # ^ |
      Проголосовать: нравится +15 Проголосовать: не нравится

    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 лет назад, # |
  Проголосовать: нравится -21 Проголосовать: не нравится

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 лет назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

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