# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261749 | 2020-08-12T04:08:07 Z | cheeheng | Climbers (RMI18_climbers) | C++14 | 800 ms | 198904 KB |
#include <bits/stdc++.h> using namespace std; int h[5005]; int h3[5005]; int h2[25000005]; int main(){ int N; scanf("%d", &N); for(int i = 0; i < N; i ++){ scanf("%d", &h[i]); } /* h3[0] = h[0]; h3[1] = h[1]; for(int i = 2; i < N; i ++){ if(h) } */ int M = 1; h2[0] = 0; for(int i = 0; i < N-1; i ++){ if(h[i] < h[i+1]){ for(int j = h[i]+1; j <= h[i+1]; j ++){ h2[M++] = j; } }else if(h[i] > h[i+1]){ for(int j = h[i]-1; j >= h[i+1]; j --){ h2[M++] = j; } } } /* for(int i = 0; i < M; i ++){ printf("%d ", h2[i]); } printf("\n"); */ for(int i = 0; i < M; i ++){ //printf("h2[%d]=%d\n", i, h2[i]); } long long ans = 0; int A = 0; int B = M-1; while(A < B){ //printf("while loop: %d %d %lld\n", A, B, ans); //if(ans > 100){break;} if(h2[A+1] == h2[B-1]){ A ++; B --; ans ++; continue; } if(h2[A-1] == h2[B-1]){ while(h2[A-1] == h2[B-1]){ A --; B --; ans ++; } }else{ while(h2[A+1] == h2[B+1]){ A ++; B ++; ans ++; } } } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1085 ms | 512 KB | Time limit exceeded |
2 | Execution timed out | 1088 ms | 2688 KB | Time limit exceeded |
3 | Execution timed out | 1071 ms | 48768 KB | Time limit exceeded |
4 | Runtime error | 181 ms | 198648 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 187 ms | 198904 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1094 ms | 256 KB | Time limit exceeded |
2 | Execution timed out | 1038 ms | 384 KB | Time limit exceeded |
3 | Execution timed out | 1099 ms | 384 KB | Time limit exceeded |
4 | Execution timed out | 1091 ms | 384 KB | Time limit exceeded |
5 | Execution timed out | 1095 ms | 384 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 4480 KB | Time limit exceeded |
2 | Execution timed out | 1096 ms | 20736 KB | Time limit exceeded |
3 | Runtime error | 170 ms | 198776 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 170 ms | 198776 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 181 ms | 198776 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 187 ms | 198808 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Execution timed out | 1095 ms | 98168 KB | Time limit exceeded |
8 | Runtime error | 180 ms | 198648 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 181 ms | 198648 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 183 ms | 198776 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |