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

Автор goextreme, 17 месяцев назад, По-английски

i was solving this problem

i got wrong answer many times(you can refer to my last submissions) on test 1, but when i checked myself with sample test-cases i got right answers.

I wonder why?

my last submission

can someone explain reason or give some hints , thanks in advance

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

»
17 месяцев назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

because in the test case 2, which offers a grid with size of 5x3 and the king is located in [5,1]. According to your codecout<<"? "<<1<<" "<<k+1<<endl;, it will output "? 1 5" where 5>3, so its illegal.

by the way, endl will flush the output automatically, so you dont need to write cout.flush(); again.