This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int N;
cin >> N;
int j = 0;
int k = 1;
for (int i = 1; i <= N; i++)
{
// cout << "i=" << i << endl;
if (i % 2 == 1)
{
cout << "? " << k << endl;
int ans;
cin >> ans;
if (ans == 0 and i != 1)
{
cout << "= " << (N - i + 2) << endl;
break;
}
k++;
}
else
{
cout << "? " << (N - j) << endl;
int ans;
cin >> ans;
if (ans == 0)
{
cout << "= " << (N - i + 2) << endl;
break;
}
j++;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |