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

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

Hello, my binary search approach for problem e is , suppose we had played x-1 round and currently at round x , we will check whether we can kill monter in that round x or not , if yes we shift high to curr round — 1 else low to curr round + 1 .

my low range query is = 2 , since i alredy checked for round 1 , trivially . and high range r = (h / abs(sum) ) +1. where sum is my vector sum .

But the approach is continuously giving WA at tc : 92 .

https://mirror.codeforces.com/contest/1141/submission/51547489

where my approach is wrong .

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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Here's a tip to debug your code. Try asserting an invariant. Then, if you get runtime error, you will know where your logic fails.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Just a first thought: doesn't std::accumulate(iter, iter, int) return an int?