# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1079308 | 2024-08-28T12:54:27 Z | speedcode | The Big Prize (IOI17_prize) | C++17 | 13 ms | 11352 KB |
#include <bits/stdc++.h> #include "prize.h" using namespace std; vector<int> dp[200000]; vector<int> myAsk(int n) { if (dp[n][0] == -1) dp[n] = ask(n); return dp[n]; } int find_best(int n) { for (int i = 0; i < n; i++) { dp[i] = {-1, -1}; } int maxi = 0; for (int i = 0; i < min(450, n); i++) { maxi = max(maxi, myAsk(i)[0] + myAsk(i)[1]); } int last = 0; auto a = myAsk(0); if (a[0] + a[1] == 0) return 0; int y = n; while (y--) { cout << last << endl; int i1 = last + 1; int i2 = n - 1; if (myAsk(i1)[0] + myAsk(i1)[1] == maxi) { last = i1; continue; } while (i1 != i2) { int middle = (i1 + i2) / 2; auto a = myAsk(middle); if (a[0] + a[1] == 0) return middle; if(middle == i1) { i1 = i2; }else { auto b = myAsk(i1); if(a[0]-b[0] > 0) { i2 = middle-1; }else { i1 = middle; } } } auto a = myAsk(i1); if (a[0] + a[1] == 0) return i1; last = i1; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 11352 KB | Token "0" doesn't correspond to pattern "[A-B]{1}" |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 11352 KB | Token "0" doesn't correspond to pattern "[A-B]{1}" |
2 | Halted | 0 ms | 0 KB | - |