Submission #722423

#TimeUsernameProblemLanguageResultExecution timeMemory
722423tvladm2009The Big Prize (IOI17_prize)C++17
0 / 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 = 1, r = N, 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; }

Compilation message (stderr)

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