Submission #289206

#TimeUsernameProblemLanguageResultExecution timeMemory
289206JoMeeThe Big Prize (IOI17_prize)C++17
20 / 100
53 ms364 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; int res = -1; int c = 0; void q(pair<int,vector<int> > l, pair<int,vector<int> > r){ if(l.first + 1 == r.first)return; if(res != -1)return; int m = (l.first+r.first)/2; if(m == l.first)return; int sz1,sz2; sz1 = l.second[0]+l.second[1]; sz1 = r.second[0]+r.second[1]; if(l.second[1] == r.second[1] && sz1 == sz2)return; c++; if(c == 11999)while(true); vector<int> ans = ask(m); if(ans[0]+ans[1] == 0){ res = m; return; } if(ans[0] > 0){ q(l,make_pair(m,ans)); } if(ans[1] > 0){ q(make_pair(m,ans),r); } } int find_best(int n) { vector<int> a1 = ask(0); if(a1[0] + a1[1] == 0)res = 0; vector<int> a2 = ask(n-1); if(a2[0] + a2[1] == 0)res = n-1; q(make_pair(0,a1),make_pair(n-1,a2)); return res; }

Compilation message (stderr)

prize.cpp: In function 'void q(std::pair<int, std::vector<int> >, std::pair<int, std::vector<int> >)':
prize.cpp:16:32: warning: 'sz2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   16 |  if(l.second[1] == r.second[1] && sz1 == sz2)return;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...