Submission #294710

#TimeUsernameProblemLanguageResultExecution timeMemory
294710ASDF123The Big Prize (IOI17_prize)C++14
0 / 100
95 ms504 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef vector<int> vi; int find_best(int n) { if (n == 1) { return 0; } int pos = 0; int q = 0; int S = sqrt(n); while (1) { q++; assert(q <= 10000); vi pos_res = ask(pos); if (pos_res[0] + pos_res[1] == 0) { return pos; } if (pos_res[0] + pos_res[1] >= S) { int l = pos, r = n; vi check = ask(l + 1); while (r - l > 1) { int mid = (l + r) >> 1; q++; assert(q <= 10000); vi mid_res = ask(mid); if (pos_res[0] == mid_res[0] && pos_res[1] == mid_res[1]) { l = mid; } else { r = mid; } } pos = l + 1; } else { pos++; } } // can't be here for (int i = 0; i < n; i++) { vi res = ask(i); if(res[0] + res[1] == 0) return i; } return 0; } //#include <bits/stdc++.h> //using namespace std; //signed main() { //cout << log2(200000) << endl; //int cnt = 190000; //while (cnt > 1) { //cout << cnt << endl; //cnt = sqrt(cnt); //} //double ans = 190000 * sqrt(190000) //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...