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"
using namespace std;
int nbVal,nbPasMax,rep;
void calc(int deb,int fin,int nbGau,int nbDro) {
if (fin<deb or nbGau+nbDro==nbPasMax) {
return;
}
int mid=(deb+fin)/2;
vector<int> ans=ask(mid);
if (ans[0]+ans[1]<nbPasMax) {
if (ans[0]+ans[1]==0) {
rep=mid;
}
calc(deb,mid-1,nbGau,ans[1]+1);
calc(mid+1,fin,ans[0]+1,nbDro);
}
else {
calc(deb,mid-1,nbGau,ans[1]);
calc(mid+1,fin,ans[0],nbDro);
}
}
int find_best(int n) {
nbVal=n;
vector<int> ans;
for (int i=0;i<min(600,nbVal);i++) {
ans=ask(i);
nbPasMax=max(nbPasMax,ans[0]+ans[1]);
}
calc(0,nbVal-1,0,0);
return rep;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |