restart_2.0's blog

By restart_2.0, history, 5 years ago, In English

Whenever I run my code on compiler it's showing output "-1", but Codeforces shows "1" and gives WA. Can anyone explain the reason behind this?

Problem Link: 1066_B

My Solution: https://ideone.com/XdpmQJ?fbclid=IwAR3dgEZMtqeKHY60H5xKsN2S_5tMsxdLocCP7fINeYo2W3Bjksv7ArJwWoo

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

because your code is not correct.

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

    But compiler showing the right output. i.e- Input: 5 10 0 0 0 0 0 Output: -1

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

      No. for example heater at the position pos. 3 can warm up all the elements in range [3- 10 + 1;3+ 10 — 1]. so the answer is not -1;