Submission #1053329

#TimeUsernameProblemLanguageResultExecution timeMemory
1053329UnforgettableplThe Big Prize (IOI17_prize)C++17
20 / 100
34 ms596 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; const int THRESHOLD_JUMP = 480; const int BIGGER_JUMP = 1024; int find_best(int n){ int worst_case = 0; for(int i=0;i<480;i++) { auto curr = ask(i); int c = curr[0]+curr[1]; if(c==0)return i; worst_case = max(worst_case,c); } for(int i=480;i<n;i++) { auto base = ask(i); int curr = base[0]+base[1]; if(curr==0)return i; if(curr==worst_case) { for(int jump=BIGGER_JUMP;jump;jump/=2) { if(i+jump>=n)continue; auto temp = ask(i+jump); if(temp==base)i+=jump; } } else { int curradded = 0; for(int jump=256;jump;jump/=2) { if(i+jump>=n)continue; if(curradded+jump>THRESHOLD_JUMP)continue; auto temp = ask(i+jump); if(temp==base){ i+=jump; curradded+=jump; } } } } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...