Submission #407347

#TimeUsernameProblemLanguageResultExecution timeMemory
407347peuchThe Big Prize (IOI17_prize)C++17
0 / 100
3051 ms4936 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; int find_best(int n) { vector<vector<int> > a(n); for(int i = 0; i < n; i++){ if(a[i].empty()) a[i] = ask(i); if(a[i][0] == 0 && a[i][1] == 0) return i; else if(n - a[i][0] - a[i][1] > 500){ int ini = i, fim = n - 1; while(ini != fim){ int mid = (ini + fim) >> 1; if(a[mid].empty()) a[mid] = ask(mid); if(a[mid][0] == 0 && a[mid][1] == 0) return i; if(a[mid][0] + a[mid][1] != a[i][0] + a[i][1]) mid = fim - 1; else if(a[mid][0] == a[i][0]) mid = ini; else mid = fim - 1; } i = ini; } } return n - 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...