Submission #804694

#TimeUsernameProblemLanguageResultExecution timeMemory
804694EllinorThe Big Prize (IOI17_prize)C++14
20 / 100
1 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i < (b); i++) #define pb push_back typedef long long ll; typedef pair<int, int> pii; #include "prize.h" int find_best(int n) { int ans; int low = 0, high = n - 1; int mid; while (low <= high) { mid = (low + high) / 2; std::vector<int> res = ask(mid); if(res[0] + res[1] == 0) ans = mid; if (res[0] > res[1]) high = mid - 1; else low = mid + 1; } return ans; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:27:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |  return ans;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...