chrs's blog

By chrs, history, 8 years ago, In English

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!

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

By chrs, history, 8 years ago, In English

Hi Friends,

Anyone know if there is a plugin somewhere for C++ so I dont have to write all the boiler plate iostream code? Or is writing Cin apart of the contest?

Ty :3

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it