Submission #65026

#TimeUsernameProblemLanguageResultExecution timeMemory
65026nvmdavaThe Big Prize (IOI17_prize)C++17
20 / 100
67 ms5652 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; vector<int> ans[200001]; map<int, set<int> > v; int L, R, counter = 0; int find_best(int n) { L = 0; R = n - 1; queue<pair<int, int> > q; q.push(make_pair(L, R)); int l, r, m; while(!q.empty()){ counter++; if(counter == 10000){ cout<<"ERT"; } l = q.front().first; r = q.front().second; q.pop(); if(L > r || l > R || l > r){ continue; } m = (l + r) >> 1; if(ans[m].size() == 0)ans[m] = ask(m); if(ans[m][0] + ans[m][1] == 0){ return m; } v[ans[m][0] + ans[m][1]].insert(m); auto it = v.find(ans[m][0] + ans[m][1]); auto loc = it -> second.find(m); bool in = 0; auto tmp = loc; while(tmp != it -> second.begin()){ if(ans[m][0] != ans[*tmp][0]){ in = 1; tmp++; q.push(make_pair(l, *tmp)); break; } tmp--; } if(in == 0){ tmp = it->second.begin(); q.push(make_pair(l, *tmp - 1)); } else { in = 0; } tmp = loc; while(tmp != it -> second.end()){ if(ans[m][0] != ans[*tmp][0]){ in = 1; tmp--; q.push(make_pair(*tmp, r)); break; } tmp++; } if(in == 0){ tmp = it->second.end(); tmp--; q.push(make_pair(*tmp + 1, r)); } } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:67:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...