# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56507 | 2018-07-11T14:13:47 Z | leejseo | 배열 탈출 (GA8_array) | C++14 | 822 ms | 66560 KB |
#include <stdio.h> #include <algorithm> const int INF = (int) 1e9; using namespace std; int A[2230][2230], D[2230][2230], N; void input(){ scanf("%d", &N); for (int i=1; i<=N; i++){ for (int j=1; j<=N; j++){ scanf("%d", &A[i][j]); } } } void DP(){ D[1][1] = 0; for (int i=0; i<=N; i++){ D[0][i] = INF; D[i][0] = INF; } for (int i=1; i<=N; i++){ for (int j=1; j<=N; j++){ if (i == 1 && j == 1) continue; D[i][j] = min(D[i-1][j] + (A[i-1][j] > A[i][j]? 0 : A[i][j] - A[i-1][j] + 1), D[i][j-1] + (A[i][j-1] > A[i][j]? 0 : A[i][j] - A[i][j-1] + 1)); } } } int main(void){ input(); DP(); printf("%d\n", D[N][N]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 508 KB | Output is correct |
4 | Correct | 3 ms | 508 KB | Output is correct |
5 | Correct | 2 ms | 620 KB | Output is correct |
6 | Correct | 2 ms | 620 KB | Output is correct |
7 | Correct | 3 ms | 640 KB | Output is correct |
8 | Correct | 2 ms | 692 KB | Output is correct |
9 | Correct | 2 ms | 692 KB | Output is correct |
10 | Correct | 3 ms | 692 KB | Output is correct |
11 | Correct | 3 ms | 696 KB | Output is correct |
12 | Correct | 3 ms | 696 KB | Output is correct |
13 | Correct | 2 ms | 696 KB | Output is correct |
14 | Correct | 2 ms | 696 KB | Output is correct |
15 | Correct | 2 ms | 696 KB | Output is correct |
16 | Correct | 3 ms | 696 KB | Output is correct |
17 | Correct | 3 ms | 696 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 696 KB | Output is correct |
2 | Correct | 2 ms | 696 KB | Output is correct |
3 | Correct | 3 ms | 696 KB | Output is correct |
4 | Correct | 3 ms | 696 KB | Output is correct |
5 | Correct | 2 ms | 716 KB | Output is correct |
6 | Correct | 3 ms | 720 KB | Output is correct |
7 | Correct | 3 ms | 724 KB | Output is correct |
8 | Correct | 2 ms | 728 KB | Output is correct |
9 | Correct | 3 ms | 732 KB | Output is correct |
10 | Correct | 2 ms | 736 KB | Output is correct |
11 | Correct | 3 ms | 744 KB | Output is correct |
12 | Correct | 2 ms | 744 KB | Output is correct |
13 | Correct | 2 ms | 748 KB | Output is correct |
14 | Correct | 2 ms | 752 KB | Output is correct |
15 | Correct | 3 ms | 756 KB | Output is correct |
16 | Correct | 2 ms | 760 KB | Output is correct |
17 | Correct | 2 ms | 816 KB | Output is correct |
18 | Correct | 2 ms | 816 KB | Output is correct |
19 | Correct | 2 ms | 816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 2976 KB | Output is correct |
2 | Correct | 11 ms | 3252 KB | Output is correct |
3 | Correct | 10 ms | 3420 KB | Output is correct |
4 | Correct | 9 ms | 3596 KB | Output is correct |
5 | Correct | 10 ms | 3756 KB | Output is correct |
6 | Correct | 9 ms | 3940 KB | Output is correct |
7 | Correct | 10 ms | 4240 KB | Output is correct |
8 | Correct | 9 ms | 4288 KB | Output is correct |
9 | Correct | 11 ms | 4332 KB | Output is correct |
10 | Correct | 12 ms | 4496 KB | Output is correct |
11 | Correct | 9 ms | 4660 KB | Output is correct |
12 | Correct | 8 ms | 4776 KB | Output is correct |
13 | Correct | 8 ms | 4924 KB | Output is correct |
14 | Correct | 9 ms | 5200 KB | Output is correct |
15 | Correct | 10 ms | 5372 KB | Output is correct |
16 | Correct | 9 ms | 5536 KB | Output is correct |
17 | Correct | 9 ms | 5716 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 697 ms | 44360 KB | Output is correct |
2 | Correct | 749 ms | 44476 KB | Output is correct |
3 | Correct | 822 ms | 44476 KB | Output is correct |
4 | Correct | 698 ms | 44476 KB | Output is correct |
5 | Correct | 715 ms | 55084 KB | Output is correct |
6 | Runtime error | 606 ms | 66560 KB | Memory limit exceeded 66560 {'time-wall': '0.659', 'max-rss': '37804', 'csw-forced': '150', 'cg-mem': '66560', 'time': '0.606', 'csw-voluntary': '4'} 65536 |
7 | Halted | 0 ms | 0 KB | - |