# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56364 | 2018-07-11T07:19:23 Z | leejseo | 배열 탈출 (GA8_array) | C++ | 890 ms | 66560 KB |
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; int N; vector<int> A[2222]; vector<int> D[2222]; inline bool valid(int i, int j) { return 0<=i && i<N && 0<=j && j<N; } void DP(){ for (int i=0; i<N; i++){ if (i >= 2){ D[i-2].clear(); A[i-2].clear(); } A[i].resize(N); D[i].resize(N); for (int j=0; j<N; j++){ scanf("%d", &A[i][j]); if (i == 0 && j == 0){ D[0][0] = 0; continue; } D[i][j] = (int)1e9; if (valid(i-1, j)) D[i][j] = min(D[i][j], D[i-1][j] + max(0, A[i][j] - A[i-1][j] + 1)); if (valid(i, j-1)) D[i][j] = min(D[i][j], D[i][j-1] + max(0, A[i][j] - A[i][j-1] + 1)); } } } int main(void){ scanf("%d", &N); DP(); printf("%d\n", D[N-1][N-1]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 488 KB | Output is correct |
3 | Correct | 3 ms | 652 KB | Output is correct |
4 | Correct | 3 ms | 652 KB | Output is correct |
5 | Correct | 2 ms | 652 KB | Output is correct |
6 | Correct | 2 ms | 696 KB | Output is correct |
7 | Correct | 4 ms | 744 KB | Output is correct |
8 | Correct | 3 ms | 744 KB | Output is correct |
9 | Correct | 3 ms | 744 KB | Output is correct |
10 | Correct | 2 ms | 744 KB | Output is correct |
11 | Correct | 2 ms | 744 KB | Output is correct |
12 | Correct | 3 ms | 744 KB | Output is correct |
13 | Correct | 2 ms | 744 KB | Output is correct |
14 | Correct | 2 ms | 744 KB | Output is correct |
15 | Correct | 2 ms | 744 KB | Output is correct |
16 | Correct | 2 ms | 744 KB | Output is correct |
17 | Correct | 2 ms | 744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 744 KB | Output is correct |
2 | Correct | 2 ms | 744 KB | Output is correct |
3 | Correct | 2 ms | 744 KB | Output is correct |
4 | Correct | 2 ms | 744 KB | Output is correct |
5 | Correct | 2 ms | 744 KB | Output is correct |
6 | Correct | 2 ms | 744 KB | Output is correct |
7 | Correct | 2 ms | 744 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 ms | 744 KB | Output is correct |
10 | Correct | 3 ms | 744 KB | Output is correct |
11 | Correct | 2 ms | 872 KB | Output is correct |
12 | Correct | 2 ms | 872 KB | Output is correct |
13 | Correct | 2 ms | 872 KB | Output is correct |
14 | Correct | 3 ms | 872 KB | Output is correct |
15 | Correct | 2 ms | 872 KB | Output is correct |
16 | Correct | 2 ms | 872 KB | Output is correct |
17 | Correct | 2 ms | 872 KB | Output is correct |
18 | Correct | 3 ms | 872 KB | Output is correct |
19 | Correct | 3 ms | 872 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1204 KB | Output is correct |
2 | Correct | 10 ms | 1216 KB | Output is correct |
3 | Correct | 10 ms | 1216 KB | Output is correct |
4 | Correct | 8 ms | 1216 KB | Output is correct |
5 | Correct | 9 ms | 1216 KB | Output is correct |
6 | Correct | 9 ms | 1216 KB | Output is correct |
7 | Correct | 9 ms | 1216 KB | Output is correct |
8 | Correct | 12 ms | 1256 KB | Output is correct |
9 | Correct | 10 ms | 1256 KB | Output is correct |
10 | Correct | 9 ms | 1256 KB | Output is correct |
11 | Correct | 9 ms | 1256 KB | Output is correct |
12 | Correct | 9 ms | 1256 KB | Output is correct |
13 | Correct | 9 ms | 1256 KB | Output is correct |
14 | Correct | 10 ms | 1296 KB | Output is correct |
15 | Correct | 16 ms | 1296 KB | Output is correct |
16 | Correct | 10 ms | 1296 KB | Output is correct |
17 | Correct | 9 ms | 1296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 730 ms | 39684 KB | Output is correct |
2 | Correct | 661 ms | 39684 KB | Output is correct |
3 | Correct | 758 ms | 39736 KB | Output is correct |
4 | Correct | 779 ms | 56688 KB | Output is correct |
5 | Correct | 599 ms | 56688 KB | Output is correct |
6 | Correct | 656 ms | 56688 KB | Output is correct |
7 | Runtime error | 890 ms | 66560 KB | Memory limit exceeded 66560 {'time-wall': '0.948', 'max-rss': '39672', 'csw-forced': '178', 'cg-mem': '66560', 'time': '0.890', 'csw-voluntary': '5'} 65536 |
8 | Halted | 0 ms | 0 KB | - |