Submission #223860

#TimeUsernameProblemLanguageResultExecution timeMemory
223860BruteforcemanWorm Worries (BOI18_worm)C++11
10 / 100
5 ms512 KiB
#include <bits/stdc++.h> using namespace std; int n, m, k, q; map <tuple <int, int, int>, int> mem; int query(int x, int y, int z) { if(mem.find(make_tuple(x, y, z)) != mem.end()) return mem[make_tuple(x, y, z)]; cout << "? " << x << " " << y << " " << z << endl; int ans; cin >> ans; if(ans == -1) exit(0); return mem[make_tuple(x, y, z)] = ans; } /* this function solves the m = k = 1 case */ int search(int b, int e) { if(b == e) { return b; } int m = (b + e) >> 1; if(query(m, 1, 1) < query(m + 1, 1, 1)) return search(m + 1, e); else return search(b, m); } int main() { cin >> n >> m >> k >> q; assert(k == 1 && m == 1); int ans = search(1, n); cout << "! " << ans << " 1 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...
#Verdict Execution timeMemoryGrader output
Fetching results...