# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7936 |
2014-08-26T10:10:25 Z |
cki86201 |
배열 탈출 (GA8_array) |
C++ |
|
652 ms |
39764 KB |
#include<stdio.h>
#include<algorithm>
int a[2225][2225], d[2225][2225];
int main(){
int n,i,j;
scanf("%d",&n);
for(i=1;i<=n;i++)for(j=1;j<=n;j++)scanf("%d",a[i]+j);
for(i=0;i<=n;i++)d[i][0] = d[0][i] = 222 * 2222 + 2;
for(i=1;i<=n;i++)for(j=1;j<=n;j++){
if(i+j==2)continue;
d[i][j] = std::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));
}
printf("%d",d[n][n]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
39764 KB |
Output is correct |
2 |
Correct |
0 ms |
39764 KB |
Output is correct |
3 |
Correct |
0 ms |
39764 KB |
Output is correct |
4 |
Correct |
0 ms |
39764 KB |
Output is correct |
5 |
Correct |
0 ms |
39764 KB |
Output is correct |
6 |
Correct |
0 ms |
39764 KB |
Output is correct |
7 |
Correct |
0 ms |
39764 KB |
Output is correct |
8 |
Correct |
0 ms |
39764 KB |
Output is correct |
9 |
Correct |
0 ms |
39764 KB |
Output is correct |
10 |
Correct |
0 ms |
39764 KB |
Output is correct |
11 |
Correct |
0 ms |
39764 KB |
Output is correct |
12 |
Correct |
0 ms |
39764 KB |
Output is correct |
13 |
Correct |
0 ms |
39764 KB |
Output is correct |
14 |
Correct |
0 ms |
39764 KB |
Output is correct |
15 |
Correct |
0 ms |
39764 KB |
Output is correct |
16 |
Correct |
0 ms |
39764 KB |
Output is correct |
17 |
Correct |
0 ms |
39764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
39764 KB |
Output is correct |
2 |
Correct |
0 ms |
39764 KB |
Output is correct |
3 |
Correct |
0 ms |
39764 KB |
Output is correct |
4 |
Correct |
0 ms |
39764 KB |
Output is correct |
5 |
Correct |
0 ms |
39764 KB |
Output is correct |
6 |
Correct |
0 ms |
39764 KB |
Output is correct |
7 |
Correct |
0 ms |
39764 KB |
Output is correct |
8 |
Correct |
0 ms |
39764 KB |
Output is correct |
9 |
Correct |
0 ms |
39764 KB |
Output is correct |
10 |
Correct |
0 ms |
39764 KB |
Output is correct |
11 |
Correct |
0 ms |
39764 KB |
Output is correct |
12 |
Correct |
0 ms |
39764 KB |
Output is correct |
13 |
Correct |
0 ms |
39764 KB |
Output is correct |
14 |
Correct |
0 ms |
39764 KB |
Output is correct |
15 |
Correct |
0 ms |
39764 KB |
Output is correct |
16 |
Correct |
0 ms |
39764 KB |
Output is correct |
17 |
Correct |
0 ms |
39764 KB |
Output is correct |
18 |
Correct |
0 ms |
39764 KB |
Output is correct |
19 |
Correct |
0 ms |
39764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
39764 KB |
Output is correct |
2 |
Correct |
8 ms |
39764 KB |
Output is correct |
3 |
Correct |
8 ms |
39764 KB |
Output is correct |
4 |
Correct |
8 ms |
39764 KB |
Output is correct |
5 |
Correct |
0 ms |
39764 KB |
Output is correct |
6 |
Correct |
4 ms |
39764 KB |
Output is correct |
7 |
Correct |
8 ms |
39764 KB |
Output is correct |
8 |
Correct |
4 ms |
39764 KB |
Output is correct |
9 |
Correct |
4 ms |
39764 KB |
Output is correct |
10 |
Correct |
8 ms |
39764 KB |
Output is correct |
11 |
Correct |
8 ms |
39764 KB |
Output is correct |
12 |
Correct |
4 ms |
39764 KB |
Output is correct |
13 |
Correct |
8 ms |
39764 KB |
Output is correct |
14 |
Correct |
0 ms |
39764 KB |
Output is correct |
15 |
Correct |
4 ms |
39764 KB |
Output is correct |
16 |
Correct |
8 ms |
39764 KB |
Output is correct |
17 |
Correct |
8 ms |
39764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
644 ms |
39764 KB |
Output is correct |
2 |
Correct |
644 ms |
39764 KB |
Output is correct |
3 |
Correct |
652 ms |
39764 KB |
Output is correct |
4 |
Correct |
640 ms |
39764 KB |
Output is correct |
5 |
Correct |
536 ms |
39764 KB |
Output is correct |
6 |
Correct |
596 ms |
39764 KB |
Output is correct |
7 |
Correct |
612 ms |
39764 KB |
Output is correct |
8 |
Correct |
636 ms |
39764 KB |
Output is correct |
9 |
Correct |
616 ms |
39764 KB |
Output is correct |
10 |
Correct |
584 ms |
39764 KB |
Output is correct |
11 |
Correct |
584 ms |
39764 KB |
Output is correct |
12 |
Correct |
552 ms |
39764 KB |
Output is correct |
13 |
Correct |
512 ms |
39764 KB |
Output is correct |
14 |
Correct |
576 ms |
39764 KB |
Output is correct |
15 |
Correct |
444 ms |
39764 KB |
Output is correct |
16 |
Correct |
576 ms |
39764 KB |
Output is correct |
17 |
Correct |
580 ms |
39764 KB |
Output is correct |
18 |
Correct |
524 ms |
39764 KB |
Output is correct |
19 |
Correct |
588 ms |
39764 KB |
Output is correct |
20 |
Correct |
568 ms |
39764 KB |
Output is correct |
21 |
Correct |
532 ms |
39764 KB |
Output is correct |