# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37661 | 2017-12-26T17:20:00 Z | szawinis | Lightning Conductor (POI11_pio) | C++14 | 706 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] + ceil(sqrt(mid - i)) > h[opt] + ceil(sqrt(mid - opt))) opt = i; res[mid] = max(int(h[opt] + 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 | 39 ms | 5932 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 66 ms | 5932 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 73 ms | 5932 KB | Output is correct |
2 | Correct | 69 ms | 5932 KB | Output is correct |
3 | Incorrect | 69 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 116 ms | 5932 KB | Output is correct |
2 | Correct | 129 ms | 5932 KB | Output is correct |
3 | Incorrect | 123 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 303 ms | 5932 KB | Output is correct |
2 | Correct | 299 ms | 5932 KB | Output is correct |
3 | Incorrect | 293 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 523 ms | 5932 KB | Output is correct |
2 | Correct | 466 ms | 5932 KB | Output is correct |
3 | Incorrect | 479 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 706 ms | 5932 KB | Output is correct |
2 | Correct | 666 ms | 5932 KB | Output is correct |
3 | Incorrect | 676 ms | 5932 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 699 ms | 5932 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |