Submission #393502

#TimeUsernameProblemLanguageResultExecution timeMemory
393502JimmyZJXThe Big Prize (IOI17_prize)C++14
20 / 100
1 ms288 KiB
#include <iostream> #include <fstream> #include <algorithm> #include <cstring> #include <climits> #include <cassert> #include <tuple> #include <queue> #include <stack> #include <vector> #include <map> #include <set> #include <string> #include <unordered_set> #include <unordered_map> #include <numeric> using namespace std; typedef long long LL; typedef vector<int> Vi; typedef vector<LL> VL; typedef vector<bool> Vb; typedef vector<vector<int>> Vii; #define forR(i, n) for (int i = 0; i < (n); i++) Vi ask(int i); int find_best(int n) { int l = 0, r = n - 1; while (l < r) { int mid = (l + r) / 2; Vi rs = ask(mid); if (rs[0] == rs[1]) return mid; if (rs[0] == 1) { r = mid - 1; } else { l = mid + 1; } } return l; } #ifdef TEST_LOCAL Vi _answer{ 2,2,1,2,2,2,2,2,2,2,2,2 }; Vi ask(int i) { int n = _answer.size(); assert(i >= 0 && i < n); int l = 0, r = 0; for (int j = 0; j < n; j++) { if (_answer[j] < _answer[i]) { if (j < i) l++; else r++; } } return Vi{ l, r }; } int main() { auto r = find_best(_answer.size()); return 0; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...