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
because your code is not correct.
But compiler showing the right output. i.e- Input: 5 10 0 0 0 0 0 Output: -1
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;