# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289208 | JoMee | The Big Prize (IOI17_prize) | C++17 | 3042 ms | 376 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 "prize.h"
#include <bits/stdc++.h>
using namespace std;
int res = -1;
int c = 0;
void q(pair<int,vector<int> > l, pair<int,vector<int> > r){
if(l.first + 1 == r.first)return;
if(res != -1)return;
int m = (l.first+r.first)/2;
if(m == l.first)return;
int sz1,sz2;
sz1 = l.second[0]+l.second[1];
sz1 = r.second[0]+r.second[1];
if(l.second[1] == r.second[1] && sz1 == sz2)return;
c++;
if(c == 9999)while(true);
vector<int> ans = ask(m);
if(ans[0]+ans[1] == 0){
res = m;
return;
}
if(ans[0] > 0){
q(l,make_pair(m,ans));
}
if(ans[1] > 0){
q(make_pair(m,ans),r);
}
}
int find_best(int n) {
vector<int> a1 = ask(0);
if(a1[0] + a1[1] == 0)res = 0;
vector<int> a2 = ask(n-1);
if(a2[0] + a2[1] == 0)res = n-1;
q(make_pair(0,a1),make_pair(n-1,a2));
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |