Submission #1030375

# Submission time Handle Problem Language Result Execution time Memory
1030375 2024-07-22T03:58:37 Z thinknoexit Colors (BOI20_colors) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
namespace Grader {
    ll c, cur = 0;
    void getinput() {
        cin >> c;
    }
    bool ask(ll x) {
        bool ch = abs(cur - x) >= c;
        cur = x;
        return ch;
    }
};
ll now = 0;
bool ask(ll x) {
    now = x;
    cout << "? " << x << endl;
    cin >> x; return x;
    // return Grader::ask(x);
}
void answer(ll x) {
    cout << "= " << x << endl;
    exit(0);
}
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    ll n;
    cin >> n;
    // debug
    Grader::getinput();
    //
    ll l = 1, r = n;
    ask(1);
    while (l < r) {
        if (now == l) {
            if (!ask(r)) answer(r - l + 1);
            else r--;
        }
        else {
            if (!ask(l)) answer(r - l + 1);
            else l++;
        }
    }
    answer(1);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 0 ms 344 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -