formidablechief27's blog

By formidablechief27, history, 7 weeks ago, In English

I was confident I had solved yesterday's C question correctly. But could not clear the idleness verdict even after flushing the output. What can be the reasons my flush didn't work as expected ?? I tried all ways fflush(stdout), cout.flush() and even just endl. None of them could clear pretest 2. All gave me idleness issues.

void response(int x, int y) {
    cout << "! " << x << " " << y << endl;
    cout.flush();
}
 
int query(int x, int y) {
    cout << "? " << x << " " << y << endl;
    cout.flush();
    int res = ini();
    return res;
}

Complete submission : 249149514

»
7 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

I think the issue is that you're missing some condition in your nested if-else, because of which you're not printing a guess for a particular test case and hence the idleness limit is exceeded.

Because if it was an input-output issue then you wouldn't have passed test 1.