Submission #260102

#TimeUsernameProblemLanguageResultExecution timeMemory
260102andreiomdThe Big Prize (IOI17_prize)C++11
20 / 100
6 ms384 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef pair < int, int > PII; map < int, bool > mp; int N, V = 0; int Candy_Sum = 0; inline PII Get_Ans (int pos) { vector < int > res = ask(pos); return {res[0], res[1]}; } inline bool IsDiamond (PII X) { return ((X.first + X.second) == 0); } inline int Go (int Left, int Right) { if(Left > Right) return 0; if(Left == Right) { PII Now = Get_Ans(Left); if(IsDiamond(Now)) return Left; return 0; } int Mid = (Left + Right) >> 1; PII Now = Get_Ans(Mid); if(IsDiamond(Now)) return Mid; if(Now.first) return Go(Left, Mid - 1); return Go(Mid + 1, Right); } int find_best(int n) { N = n; for(int i = 0; i < min(N, 501); ++i) { PII Now = Get_Ans(i); if(IsDiamond(Now)) return i; mp[Now.first + Now.second] = 1; Candy_Sum = max(Candy_Sum, Now.first + Now.second); } for(auto it : mp) ++V; if(V <= 2) return Go(0, N - 1); return 0; }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:69:14: warning: variable 'it' set but not used [-Wunused-but-set-variable]
     for(auto it : mp)
              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...