Submission #835841

#TimeUsernameProblemLanguageResultExecution timeMemory
835841oscar1fThe Big Prize (IOI17_prize)C++17
93.04 / 100
57 ms348 KiB
#include<bits/stdc++.h> #include "prize.h" using namespace std; int nbVal,nbPasMax,rep=-1; void calc(int deb,int fin,int nbGau,int nbDro) { if (fin<deb or nbGau+nbDro==nbPasMax or rep!=-1) { 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(474,nbVal);i++) { ans=ask(i); nbPasMax=max(nbPasMax,ans[0]+ans[1]); } calc(0,nbVal-1,0,0); return rep; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...