# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7243 |
2014-07-28T12:52:12 Z |
gs13068 |
배열 탈출 (GA8_array) |
C++ |
|
668 ms |
39696 KB |
#include<cstdio>
#include<algorithm>
int a[2223][2223];
int d[2223][2223];
int main()
{
int i,j,n;
scanf("%d",&n);
for(i=1;i<=n;i++)for(j=1;j<=n;j++)
{
scanf("%d",&a[i][j]);
if(a[i][j]<1||a[i][j]>222)while(1);
}
for(i=2;i<=n;i++)a[i][0]=-246421;
for(j=2;j<=n;j++)a[0][j]=-246421;
for(i=1;i<=n;i++)for(j=1;j<=n;j++)d[i][j]=std::min(d[i-1][j]+std::max(a[i][j]-a[i-1][j]+1,0),d[i][j-1]+std::max(a[i][j]-a[i][j-1]+1,0));
printf("%d",d[n][n]-a[1][1]-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
39696 KB |
Output is correct |
2 |
Correct |
0 ms |
39696 KB |
Output is correct |
3 |
Correct |
0 ms |
39696 KB |
Output is correct |
4 |
Correct |
0 ms |
39696 KB |
Output is correct |
5 |
Correct |
0 ms |
39696 KB |
Output is correct |
6 |
Correct |
0 ms |
39696 KB |
Output is correct |
7 |
Correct |
0 ms |
39696 KB |
Output is correct |
8 |
Correct |
0 ms |
39696 KB |
Output is correct |
9 |
Correct |
0 ms |
39696 KB |
Output is correct |
10 |
Correct |
0 ms |
39696 KB |
Output is correct |
11 |
Correct |
0 ms |
39696 KB |
Output is correct |
12 |
Correct |
0 ms |
39696 KB |
Output is correct |
13 |
Correct |
0 ms |
39696 KB |
Output is correct |
14 |
Correct |
0 ms |
39696 KB |
Output is correct |
15 |
Correct |
0 ms |
39696 KB |
Output is correct |
16 |
Correct |
0 ms |
39696 KB |
Output is correct |
17 |
Correct |
0 ms |
39696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
39696 KB |
Output is correct |
2 |
Correct |
0 ms |
39696 KB |
Output is correct |
3 |
Correct |
0 ms |
39696 KB |
Output is correct |
4 |
Correct |
0 ms |
39696 KB |
Output is correct |
5 |
Correct |
0 ms |
39696 KB |
Output is correct |
6 |
Correct |
0 ms |
39696 KB |
Output is correct |
7 |
Correct |
0 ms |
39696 KB |
Output is correct |
8 |
Correct |
0 ms |
39696 KB |
Output is correct |
9 |
Correct |
0 ms |
39696 KB |
Output is correct |
10 |
Correct |
0 ms |
39696 KB |
Output is correct |
11 |
Correct |
0 ms |
39696 KB |
Output is correct |
12 |
Correct |
0 ms |
39696 KB |
Output is correct |
13 |
Correct |
0 ms |
39696 KB |
Output is correct |
14 |
Correct |
0 ms |
39696 KB |
Output is correct |
15 |
Correct |
0 ms |
39696 KB |
Output is correct |
16 |
Correct |
0 ms |
39696 KB |
Output is correct |
17 |
Correct |
0 ms |
39696 KB |
Output is correct |
18 |
Correct |
0 ms |
39696 KB |
Output is correct |
19 |
Correct |
0 ms |
39696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
39696 KB |
Output is correct |
2 |
Correct |
4 ms |
39696 KB |
Output is correct |
3 |
Correct |
4 ms |
39696 KB |
Output is correct |
4 |
Correct |
8 ms |
39696 KB |
Output is correct |
5 |
Correct |
8 ms |
39696 KB |
Output is correct |
6 |
Correct |
8 ms |
39696 KB |
Output is correct |
7 |
Correct |
8 ms |
39696 KB |
Output is correct |
8 |
Correct |
4 ms |
39696 KB |
Output is correct |
9 |
Correct |
0 ms |
39696 KB |
Output is correct |
10 |
Correct |
4 ms |
39696 KB |
Output is correct |
11 |
Correct |
8 ms |
39696 KB |
Output is correct |
12 |
Correct |
4 ms |
39696 KB |
Output is correct |
13 |
Correct |
8 ms |
39696 KB |
Output is correct |
14 |
Correct |
4 ms |
39696 KB |
Output is correct |
15 |
Correct |
4 ms |
39696 KB |
Output is correct |
16 |
Correct |
0 ms |
39696 KB |
Output is correct |
17 |
Correct |
8 ms |
39696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
648 ms |
39696 KB |
Output is correct |
2 |
Correct |
636 ms |
39696 KB |
Output is correct |
3 |
Correct |
668 ms |
39696 KB |
Output is correct |
4 |
Correct |
604 ms |
39696 KB |
Output is correct |
5 |
Correct |
496 ms |
39696 KB |
Output is correct |
6 |
Correct |
544 ms |
39696 KB |
Output is correct |
7 |
Correct |
624 ms |
39696 KB |
Output is correct |
8 |
Correct |
612 ms |
39696 KB |
Output is correct |
9 |
Correct |
624 ms |
39696 KB |
Output is correct |
10 |
Correct |
580 ms |
39696 KB |
Output is correct |
11 |
Incorrect |
600 ms |
39696 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |