Submission #1094513

# Submission time Handle Problem Language Result Execution time Memory
1094513 2024-09-29T18:02:33 Z andrewp Colors (BOI20_colors) C++14
0 / 100
0 ms 344 KB
//Dedicated to my love, ivaziva
#pragma GCC optimize("Ofast") 
#include <bits/stdc++.h> 
using namespace std;  
 
using pii = pair<int, int>;
using ll = int64_t;
 
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define dbg(x) cerr << #x << ": " << x << '\n';  

const ll maxn = (ll)(1e18);
ll n;

int ask(ll x) {
    cout << "? " << x << endl; 
    int ret; cin >> ret;
    return ret; 
}

void Solve() {
    cin >> n;
    ll l = 1, r = maxn + 1, lst = 1, ans = maxn;
    ask(1); 
    while (l <= r) {
        ll mid = (l + r) / 2;   
        dbg(mid);
        int ret = ask(mid + lst);
        if (ret) {
            r = mid - 1; 
            ans = mid;
        } else {
            l = mid + 1;
        }
    }   
    cout << "= " << ans << endl; 
}   
 
int32_t main()  {
    ios::sync_with_stdio(false); cin.tie(nullptr);  
    cout.tie(nullptr); cerr.tie(nullptr);
     
    Solve();
    return 0;   
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -