# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56360 | 2018-07-11T07:12:13 Z | leejseo | 배열 탈출 (GA8_array) | C++ | 700 ms | 66560 KB |
#include <stdio.h> #include <algorithm> using namespace std; int A[2222][2222], D[2222][2222], N; inline bool valid(int i, int j) { return 0<=i && i<N && 0<=j && j<N; } void input(){ scanf("%d", &N); for (int i=0; i<N; i++){ for (int j=0; j<N; j++){ scanf("%d", &A[i][j]); } } } void DP(){ D[0][0] = 0; for (int i=0; i<N; i++){ for (int j=0; j<N; j++){ if (i == 0 && j == 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){ input(); DP(); printf("%d\n", D[N-1][N-1]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 496 KB | Output is correct |
6 | Correct | 3 ms | 532 KB | Output is correct |
7 | Correct | 2 ms | 532 KB | Output is correct |
8 | Correct | 2 ms | 744 KB | Output is correct |
9 | Correct | 2 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 | 2 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 744 KB | Output is correct |
2 | Correct | 2 ms | 744 KB | Output is correct |
3 | Correct | 3 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 | 4 ms | 744 KB | Output is correct |
8 | Correct | 3 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 | 748 KB | Output is correct |
12 | Correct | 3 ms | 748 KB | Output is correct |
13 | Correct | 2 ms | 752 KB | Output is correct |
14 | Correct | 2 ms | 756 KB | Output is correct |
15 | Correct | 3 ms | 760 KB | Output is correct |
16 | Correct | 2 ms | 812 KB | Output is correct |
17 | Correct | 2 ms | 812 KB | Output is correct |
18 | Correct | 2 ms | 812 KB | Output is correct |
19 | Correct | 2 ms | 812 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 2956 KB | Output is correct |
2 | Correct | 11 ms | 2956 KB | Output is correct |
3 | Correct | 12 ms | 2956 KB | Output is correct |
4 | Correct | 11 ms | 2956 KB | Output is correct |
5 | Correct | 17 ms | 2956 KB | Output is correct |
6 | Correct | 10 ms | 2956 KB | Output is correct |
7 | Correct | 11 ms | 2956 KB | Output is correct |
8 | Correct | 13 ms | 2956 KB | Output is correct |
9 | Correct | 10 ms | 2956 KB | Output is correct |
10 | Correct | 11 ms | 2956 KB | Output is correct |
11 | Correct | 9 ms | 2956 KB | Output is correct |
12 | Correct | 13 ms | 3008 KB | Output is correct |
13 | Correct | 10 ms | 3012 KB | Output is correct |
14 | Correct | 9 ms | 3012 KB | Output is correct |
15 | Correct | 11 ms | 3012 KB | Output is correct |
16 | Correct | 13 ms | 3012 KB | Output is correct |
17 | Correct | 9 ms | 3012 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 616 ms | 39544 KB | Output is correct |
2 | Correct | 593 ms | 39544 KB | Output is correct |
3 | Correct | 626 ms | 39544 KB | Output is correct |
4 | Correct | 700 ms | 56516 KB | Output is correct |
5 | Correct | 581 ms | 56516 KB | Output is correct |
6 | Runtime error | 652 ms | 66560 KB | Memory limit exceeded 66560 {'time-wall': '0.744', 'max-rss': '37664', 'csw-forced': '160', 'cg-mem': '66560', 'time': '0.652', 'csw-voluntary': '6'} 65536 |
7 | Halted | 0 ms | 0 KB | - |