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
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 code
cout<<"? "<<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 writecout.flush();
again.but k will be 4 in that case,i think
sorry my bad, read the explaination again