제출 #722424

#제출 시각아이디문제언어결과실행 시간메모리
722424tvladm2009커다란 상품 (IOI17_prize)C++17
20 / 100
1 ms336 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; typedef long long ll; int find_best(int N) { int l = 0, r = N - 1, sol; while (l <= r) { int mid = (l + r) / 2; vector <int> cnt = ask(mid); if (cnt[0] == 0 && cnt[1] == 0) { return mid; } if (cnt[0] < cnt[1]) { sol = mid; l = mid + 1; } else { r = mid - 1; } } return sol; }

컴파일 시 표준 에러 (stderr) 메시지

prize.cpp: In function 'int find_best(int)':
prize.cpp:9:27: warning: 'sol' may be used uninitialized in this function [-Wmaybe-uninitialized]
    9 |     int l = 0, r = N - 1, sol;
      |                           ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...