Submission #649654

#TimeUsernameProblemLanguageResultExecution timeMemory
649654welleythColors (BOI20_colors)C++17
9 / 100
2 ms324 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define int long long #define pb push_back #define mp make_pair //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") constexpr int N = (int)2e5 + 111; constexpr int md = (int)2e5 + 111; mt19937 rnd(time(nullptr)); set<int> was_asked; int ask(int x){ assert(!was_asked.count(x)); was_asked.insert(x); cout << "? " << x << "\n"; cout.flush(); int answer; cin >> answer; return answer; } void solve(){ int n; cin >> n; ask(1); int pr = 1; int l = 2, r = n; for(int it = 0; l <= r; it^=1){ if(it == 0){ int check = ask(r--); if(!check){ cout << "= " << r - l + 3 << "\n"; return; } } else { int check = ask(l++); if(!check){ cout << "= " << r - l + 3 << "\n"; return; } } } cout << "= " << "1\n"; return; } signed main(){ ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); // init(); int tests = 1; // cin >> tests; for(int test = 1; test <= tests; test++){ // cerr << "test = " << test << "\n"; solve(); } return 0; } /** **/

Compilation message (stderr)

Colors.cpp: In function 'void solve()':
Colors.cpp:37:9: warning: unused variable 'pr' [-Wunused-variable]
   37 |     int pr = 1;
      |         ^~
#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...