# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104400 | Badral | The Big Prize (IOI17_prize) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "prize.h"
int can(int k) {
vector<int> cer = ask(k);
if(cer[0] == 0 && cer[1] == 0)
return 2;
if(cer[0] == 1) return 0;
return 1;
}
int find_best(int n) {
for(int i = 0; i < n; i++) {
std::vector<int> res = ask(i);
if(res[0] + res[1] == 0)
return i;
}
int kk = 0;
for(int i = n; i >= 1; i /= 2) {}
int p = can(i+kk);
if(p == 2)
return i+kk;
while(i+kk <= n && p)
kk += i;
}
return kk;
}