# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37663 | 2017-12-26T17:25:04 Z | szawinis | Lightning Conductor (POI11_pio) | C++14 | 699 ms | 5932 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 5e5+1; int n, h[N], res[N]; void solve(int l, int r, int optL, int optR) { if(l > r) return; int mid = l+r >> 1, opt = optL; for(int i = optL; i <= min(optR, mid); i++) if(h[i] + (int) ceil(sqrt(mid - i)) > h[opt] + (int) ceil(sqrt(mid - opt))) opt = i; res[mid] = max(h[opt] + (int) ceil(sqrt(mid - opt)) - h[mid], res[mid]); solve(l, mid-1, optL, opt); solve(mid+1, r, opt, optR); } int main() { scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%d", &h[i]); solve(0, n-1, 0, n-1); reverse(h, h+n); reverse(res, res+n); solve(0, n-1, 0, n-1); reverse(h, h+n); reverse(res, res+n); for(int i = 0; i < n; i++) printf("%d\n", res[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5932 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 5932 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 5932 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 5932 KB | Output is correct |
2 | Correct | 66 ms | 5932 KB | Output is correct |
3 | Incorrect | 69 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 5932 KB | Output is correct |
2 | Correct | 113 ms | 5932 KB | Output is correct |
3 | Incorrect | 113 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 289 ms | 5932 KB | Output is correct |
2 | Correct | 256 ms | 5932 KB | Output is correct |
3 | Incorrect | 283 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 456 ms | 5932 KB | Output is correct |
2 | Correct | 416 ms | 5932 KB | Output is correct |
3 | Incorrect | 466 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 699 ms | 5932 KB | Output is correct |
2 | Correct | 673 ms | 5932 KB | Output is correct |
3 | Incorrect | 616 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 636 ms | 5932 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |