Submission #566520

#TimeUsernameProblemLanguageResultExecution timeMemory
566520SifferThe Big Prize (IOI17_prize)C++14
20 / 100
1 ms296 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; int find_best(int n) { if(ask(0)[1]==0) return 0; vector<int> s, as; int a = 1; int b = 1; while(b <= n) { s.push_back(a); as.push_back(b); a = a*a + 1; b += a; } int k = 0; int p = 0; for(; (1<<(p+1)) <= n; p++); for(int i = p; ~i; i--) { int l = k+(1<<i); if(l < n && ask(l)[1]) k = l; } return k+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...