제출 #423107

#제출 시각아이디문제언어결과실행 시간메모리
423107Pbezz커다란 상품 (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; }

컴파일 시 표준 에러 (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...