# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167437 | 2019-12-08T14:51:48 Z | Thuleanx | Lightning Conductor (POI11_pio) | C++14 | 1000 ms | 18992 KB |
#include <bits/stdc++.h> using namespace std; const int N = 5e5+7; int n; int h[N]; int L[N], R[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); scanf("%d", &n); memset(L,0,sizeof(L)); memset(R,0,sizeof(R)); for (int i = 0; i < n; i++) scanf("%d", &h[i]); for (int i = 0; i < n; i++) { for (int j = 0; i+j*j+1 < n; j++) L[i+j*j+1] = max(L[i+j*j+1], h[i] + j + 1); for (int j = 0; i-j*j-1 >= 0; j++) R[i-j*j-1] = max(R[i-j*j-1], h[i] + j + 1); } for (int i = 1; i < n; i++) L[i] = max(L[i], L[i-1]); for (int i = n-2; i >= 0; i--) R[i] = max(R[i], R[i+1]); stringstream ss; for (int i = 0; i < n; i++) ss << max(0, max(L[i],R[i]) - h[i]) << endl; cout << ss.str(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4216 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 5656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 6616 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 63 ms | 6136 KB | Output is correct |
2 | Correct | 57 ms | 5624 KB | Output is correct |
3 | Correct | 61 ms | 6636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 7124 KB | Output is correct |
2 | Correct | 112 ms | 6900 KB | Output is correct |
3 | Correct | 113 ms | 8300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 380 ms | 10800 KB | Output is correct |
2 | Correct | 374 ms | 10096 KB | Output is correct |
3 | Correct | 374 ms | 11368 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 840 ms | 18992 KB | Output is correct |
2 | Correct | 792 ms | 13004 KB | Output is correct |
3 | Correct | 796 ms | 18212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1063 ms | 7176 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1074 ms | 7160 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |