Submission #599327

#TimeUsernameProblemLanguageResultExecution timeMemory
599327OttoTheDinoColors (BOI20_colors)C++17
0 / 100
1 ms208 KiB
    #include<bits/stdc++.h>
    using namespace std;
     
    #define rep(i,s,e)                          for (int i = s; i <= e; ++i)
    #define rrep(i,s,e)                         for (int i = s; i >= e; --i)
    #define fi                                  first
    #define se                                  second
    #define pb                                  push_back
    typedef vector<int> vi;
    typedef pair<int,int> ii;
     
    int main() {
        ios::sync_with_stdio(0);
        cin.tie(0);
     
        int n; cin >> n;
        int x = 1, y = n+1, tp = 1;
        while (y>x) {
            if (tp) {
                cout << "? " << x << endl;
                y--;
            }
            else {
                cout << "? " << y << endl;
                x++;
            }
            int res; cin >> res;
            if (res==0) break;
            tp ^= 1;
        }
        cout << "= " <<y-x+1 << endl;
     
        return 0;
    }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...