# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7476 |
2014-08-09T09:54:44 Z |
gs13105 |
배열 탈출 (GA8_array) |
C++ |
|
620 ms |
39660 KB |
#include <stdio.h>
int arr[2222][2222];
int mem[2222][2222];
inline int mx(int a,int b)
{
return a>b?a:b;
}
inline int mn(int a,int b)
{
return a<b?a:b;
}
int main()
{
int n,i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&arr[i][j]);
for(i=n-2;i>=0;i--)
{
mem[i][n-1]=mx(arr[i+1][n-1]-arr[i][n-1]+1,0)+mem[i+1][n-1];
mem[n-1][i]=mx(arr[n-1][i+1]-arr[n-1][i]+1,0)+mem[n-1][i+1];
}
for(i=n-2;i>=0;i--)
for(j=n-2;j>=0;j--)
mem[i][j]=mn(mx(arr[i+1][j]-arr[i][j]+1,0)+mem[i+1][j],mx(arr[i][j+1]-arr[i][j]+1,0)+mem[i][j+1]);
printf("%d",mem[0][0]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
39660 KB |
Output is correct |
2 |
Correct |
0 ms |
39660 KB |
Output is correct |
3 |
Correct |
0 ms |
39660 KB |
Output is correct |
4 |
Correct |
0 ms |
39660 KB |
Output is correct |
5 |
Correct |
0 ms |
39660 KB |
Output is correct |
6 |
Correct |
0 ms |
39660 KB |
Output is correct |
7 |
Correct |
0 ms |
39660 KB |
Output is correct |
8 |
Correct |
0 ms |
39660 KB |
Output is correct |
9 |
Correct |
0 ms |
39660 KB |
Output is correct |
10 |
Correct |
0 ms |
39660 KB |
Output is correct |
11 |
Correct |
0 ms |
39660 KB |
Output is correct |
12 |
Correct |
0 ms |
39660 KB |
Output is correct |
13 |
Correct |
0 ms |
39660 KB |
Output is correct |
14 |
Correct |
0 ms |
39660 KB |
Output is correct |
15 |
Correct |
0 ms |
39660 KB |
Output is correct |
16 |
Correct |
0 ms |
39660 KB |
Output is correct |
17 |
Correct |
0 ms |
39660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
39660 KB |
Output is correct |
2 |
Correct |
0 ms |
39660 KB |
Output is correct |
3 |
Correct |
0 ms |
39660 KB |
Output is correct |
4 |
Correct |
0 ms |
39660 KB |
Output is correct |
5 |
Correct |
0 ms |
39660 KB |
Output is correct |
6 |
Correct |
0 ms |
39660 KB |
Output is correct |
7 |
Correct |
0 ms |
39660 KB |
Output is correct |
8 |
Correct |
0 ms |
39660 KB |
Output is correct |
9 |
Correct |
0 ms |
39660 KB |
Output is correct |
10 |
Correct |
0 ms |
39660 KB |
Output is correct |
11 |
Correct |
0 ms |
39660 KB |
Output is correct |
12 |
Correct |
0 ms |
39660 KB |
Output is correct |
13 |
Correct |
0 ms |
39660 KB |
Output is correct |
14 |
Correct |
0 ms |
39660 KB |
Output is correct |
15 |
Correct |
0 ms |
39660 KB |
Output is correct |
16 |
Correct |
0 ms |
39660 KB |
Output is correct |
17 |
Correct |
0 ms |
39660 KB |
Output is correct |
18 |
Correct |
0 ms |
39660 KB |
Output is correct |
19 |
Correct |
0 ms |
39660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
39660 KB |
Output is correct |
2 |
Correct |
0 ms |
39660 KB |
Output is correct |
3 |
Correct |
8 ms |
39660 KB |
Output is correct |
4 |
Correct |
8 ms |
39660 KB |
Output is correct |
5 |
Correct |
4 ms |
39660 KB |
Output is correct |
6 |
Correct |
0 ms |
39660 KB |
Output is correct |
7 |
Correct |
8 ms |
39660 KB |
Output is correct |
8 |
Correct |
8 ms |
39660 KB |
Output is correct |
9 |
Correct |
8 ms |
39660 KB |
Output is correct |
10 |
Correct |
4 ms |
39660 KB |
Output is correct |
11 |
Correct |
4 ms |
39660 KB |
Output is correct |
12 |
Correct |
8 ms |
39660 KB |
Output is correct |
13 |
Correct |
4 ms |
39660 KB |
Output is correct |
14 |
Correct |
0 ms |
39660 KB |
Output is correct |
15 |
Correct |
4 ms |
39660 KB |
Output is correct |
16 |
Correct |
0 ms |
39660 KB |
Output is correct |
17 |
Correct |
4 ms |
39660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
592 ms |
39660 KB |
Output is correct |
2 |
Correct |
596 ms |
39660 KB |
Output is correct |
3 |
Correct |
620 ms |
39660 KB |
Output is correct |
4 |
Correct |
620 ms |
39660 KB |
Output is correct |
5 |
Correct |
508 ms |
39660 KB |
Output is correct |
6 |
Correct |
552 ms |
39660 KB |
Output is correct |
7 |
Correct |
600 ms |
39660 KB |
Output is correct |
8 |
Correct |
588 ms |
39660 KB |
Output is correct |
9 |
Correct |
620 ms |
39660 KB |
Output is correct |
10 |
Correct |
588 ms |
39660 KB |
Output is correct |
11 |
Correct |
552 ms |
39660 KB |
Output is correct |
12 |
Correct |
552 ms |
39660 KB |
Output is correct |
13 |
Correct |
496 ms |
39660 KB |
Output is correct |
14 |
Correct |
556 ms |
39660 KB |
Output is correct |
15 |
Correct |
472 ms |
39660 KB |
Output is correct |
16 |
Correct |
584 ms |
39660 KB |
Output is correct |
17 |
Correct |
576 ms |
39660 KB |
Output is correct |
18 |
Correct |
540 ms |
39660 KB |
Output is correct |
19 |
Correct |
580 ms |
39660 KB |
Output is correct |
20 |
Correct |
568 ms |
39660 KB |
Output is correct |
21 |
Correct |
532 ms |
39660 KB |
Output is correct |