Submission #7191

# Submission time Handle Problem Language Result Execution time Memory
7191 2014-07-27T14:19:13 Z tncks0121 배열 탈출 (GA8_array) C++
100 / 100
660 ms 40008 KB
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <memory.h> 
#include <math.h> 
#include <assert.h> 
#include <stack> 
#include <queue> 
#include <map> 
#include <set> 
#include <algorithm> 
#include <string> 
#include <functional> 
#include <vector> 
#include <deque> 
#include <utility> 
#include <bitset> 
#include <limits.h>  

using namespace std; 
typedef long long ll; 
typedef unsigned long long llu; 
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;

const int SZ = 2222;

int N;
int A[SZ+10][SZ+10];
int Table[SZ+10][SZ+10];

int main() {
	scanf("%d", &N);
	for(int i = 1; i <= N; i++) for(int j = 1; j <= N; j++) scanf("%d", &A[i][j]), Table[i][j] = (int)1e9;

	Table[1][1] = 0;
	for(int i = 1; i <= N; i++) for(int j = 1; j <= N; j++) {
		if(i+1 <= N) Table[i+1][j] = min(Table[i+1][j], Table[i][j] + max(A[i+1][j] - A[i][j] + 1, 0));
		if(j+1 <= N) Table[i][j+1] = min(Table[i][j+1], Table[i][j] + max(A[i][j+1] - A[i][j] + 1, 0));
	}

	printf("%d\n", Table[N][N]);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40008 KB Output is correct
2 Correct 0 ms 40008 KB Output is correct
3 Correct 0 ms 40008 KB Output is correct
4 Correct 0 ms 40008 KB Output is correct
5 Correct 0 ms 40008 KB Output is correct
6 Correct 0 ms 40008 KB Output is correct
7 Correct 0 ms 40008 KB Output is correct
8 Correct 0 ms 40008 KB Output is correct
9 Correct 0 ms 40008 KB Output is correct
10 Correct 0 ms 40008 KB Output is correct
11 Correct 0 ms 40008 KB Output is correct
12 Correct 0 ms 40008 KB Output is correct
13 Correct 0 ms 40008 KB Output is correct
14 Correct 0 ms 40008 KB Output is correct
15 Correct 0 ms 40008 KB Output is correct
16 Correct 0 ms 40008 KB Output is correct
17 Correct 0 ms 40008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40008 KB Output is correct
2 Correct 0 ms 40008 KB Output is correct
3 Correct 0 ms 40008 KB Output is correct
4 Correct 0 ms 40008 KB Output is correct
5 Correct 0 ms 40008 KB Output is correct
6 Correct 0 ms 40008 KB Output is correct
7 Correct 0 ms 40008 KB Output is correct
8 Correct 0 ms 40008 KB Output is correct
9 Correct 0 ms 40008 KB Output is correct
10 Correct 0 ms 40008 KB Output is correct
11 Correct 0 ms 40008 KB Output is correct
12 Correct 0 ms 40008 KB Output is correct
13 Correct 0 ms 40008 KB Output is correct
14 Correct 0 ms 40008 KB Output is correct
15 Correct 0 ms 40008 KB Output is correct
16 Correct 0 ms 40008 KB Output is correct
17 Correct 0 ms 40008 KB Output is correct
18 Correct 0 ms 40008 KB Output is correct
19 Correct 0 ms 40008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 40008 KB Output is correct
2 Correct 4 ms 40008 KB Output is correct
3 Correct 8 ms 40008 KB Output is correct
4 Correct 4 ms 40008 KB Output is correct
5 Correct 8 ms 40008 KB Output is correct
6 Correct 8 ms 40008 KB Output is correct
7 Correct 8 ms 40008 KB Output is correct
8 Correct 8 ms 40008 KB Output is correct
9 Correct 4 ms 40008 KB Output is correct
10 Correct 8 ms 40008 KB Output is correct
11 Correct 4 ms 40008 KB Output is correct
12 Correct 8 ms 40008 KB Output is correct
13 Correct 8 ms 40008 KB Output is correct
14 Correct 4 ms 40008 KB Output is correct
15 Correct 8 ms 40008 KB Output is correct
16 Correct 8 ms 40008 KB Output is correct
17 Correct 0 ms 40008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 632 ms 40008 KB Output is correct
2 Correct 628 ms 40008 KB Output is correct
3 Correct 596 ms 40008 KB Output is correct
4 Correct 660 ms 40008 KB Output is correct
5 Correct 528 ms 40008 KB Output is correct
6 Correct 560 ms 40008 KB Output is correct
7 Correct 616 ms 40008 KB Output is correct
8 Correct 636 ms 40008 KB Output is correct
9 Correct 644 ms 40008 KB Output is correct
10 Correct 632 ms 40008 KB Output is correct
11 Correct 572 ms 40008 KB Output is correct
12 Correct 568 ms 40008 KB Output is correct
13 Correct 516 ms 40008 KB Output is correct
14 Correct 568 ms 40008 KB Output is correct
15 Correct 476 ms 40008 KB Output is correct
16 Correct 612 ms 40008 KB Output is correct
17 Correct 600 ms 40008 KB Output is correct
18 Correct 544 ms 40008 KB Output is correct
19 Correct 624 ms 40008 KB Output is correct
20 Correct 584 ms 40008 KB Output is correct
21 Correct 524 ms 40008 KB Output is correct