Submission #423107

#TimeUsernameProblemLanguageResultExecution timeMemory
423107PbezzThe Big Prize (IOI17_prize)C++14
0 / 100
1 ms320 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back typedef pair<ll,ll> pii; const ll MAXN=2e5+5; const ll INF=1e9+7; int find_best(int n) { ll i; ll lo=0,hi=n-1,mid; while(hi-lo>=2){ mid = lo+(hi-lo)/2; vector<int> res = ask(mid); if(res[0]+res[1]==0)return mid; if(res[0]==1){ hi=mid; }else{ lo=mid; } } for(i=lo;i<=hi;i++){ vector<int> res = ask(mid); if(res[0]+res[1]==0)return mid; } return 0; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:35:27: warning: 'mid' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |  vector<int> res = ask(mid);
      |                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...