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

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

Hi friends,

I am so lost and frustrated about this problem that took place in yesterday's contest. http://mirror.codeforces.com/contest/1011/problem/D

Here is the solution I am looking at http://mirror.codeforces.com/contest/1011/submission/40824907

And here is my code, clearly showing that my understanding of the problem is incorrect http://mirror.codeforces.com/contest/1011/submission/40855182

The input in the problem statement clearly shows

5 2 1 -1 -1 1 0

But the actual input is like this:

5 2 3 1 0

I understand what the question wants me to do. But for the life of me, I cannot figure out how the solution of this problem works and why is the input in the problem and the actual input different?

The thing I am most stuck on are 3 things

Line 3: ask() function and what it's suppose to do

Line 22: for(int i=1;i<=n;i++)op[i]=ask(1); //what this op[] array is

Line 25: Why do we need a binary search for this question

line 27: if(ask(mid)^op[k%n+1])r=mid; // what is this trying to accomplish

Can someone explain this question/solution to me? I really appreciate any help!

Thank you!

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

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

I mean, it doesn't seem like your solution is doing anything, or printing out any output... This is an interactive problem, which means the input changes depending on what you output. The input given in the sample statement is an example back and forth between a user's solution and the judge. The input given in the feedback is an input to initialize the judge, and is based off the "hacking"section of the problem statement.