Submission #1195470

#TimeUsernameProblemLanguageResultExecution timeMemory
1195470raphaelpMađioničar (COI22_madionicar)C++20
100 / 100
472 ms1552 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int best = 0;
    vector<int> Tab;
    for (int i = 0; i < N; i++)
    {
        Tab.push_back(N + i);
        if (i > 0)
            Tab.push_back(N - i);
    }
    for (int i = 0; i < 2 * N - 1; i++)
    {
        int x = Tab[i];
        int t = 1;
        while (t)
        {
            int sz = best + 1;
            if (sz % 2 != x % 2)
                sz++;
            int L = (x - sz) / 2 + 1, R = (x + sz) / 2;
            if (L < 1 || R > N)
                break;
            cout << "? " << L << ' ' << R << endl;
            cin >> t;
            if (t)
                best = sz;
        }
    }
    cout << "! " << best << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...