# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261744 | 2020-08-12T03:59:01 Z | cheeheng | Climbers (RMI18_climbers) | C++14 | 800 ms | 5240 KB |
#include <bits/stdc++.h> using namespace std; int h[5005]; int h2[250005]; int main(){ int N; scanf("%d", &N); for(int i = 0; i < N; i ++){ scanf("%d", &h[i]); } 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("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 | 1096 ms | 1024 KB | Time limit exceeded |
2 | Execution timed out | 1083 ms | 5240 KB | Time limit exceeded |
3 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 4 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 384 KB | Time limit exceeded |
2 | Execution timed out | 1090 ms | 384 KB | Time limit exceeded |
3 | Execution timed out | 1086 ms | 512 KB | Time limit exceeded |
4 | Execution timed out | 1083 ms | 640 KB | Time limit exceeded |
5 | Execution timed out | 1076 ms | 512 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1 ms | 1280 KB | Time limit exceeded (wall clock) |
2 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 3 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 4 ms | 2432 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |