Submission #650244

#TimeUsernameProblemLanguageResultExecution timeMemory
650244ojoConmigoThe Big Prize (IOI17_prize)C++17
20 / 100
1 ms336 KiB
#include "prize.h" 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; } */ //Subtask 1 std::vector<int> res; int lo = 0, hi = n-1,ans = -1; while(lo <= hi){ int mid = (lo+hi)/2; res = ask(mid); if(res[0] + res[1] == 0){ return mid; }else if(res[0]){ hi = mid-1; }else{ lo = mid+1; } } return 0; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:13:23: warning: unused variable 'ans' [-Wunused-variable]
   13 |  int lo = 0, hi = n-1,ans = -1;
      |                       ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...