# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
7225 |
2014-07-28T11:44:15 Z |
gs13068 |
배열 탈출 (GA8_array) |
C++ |
|
584 ms |
20372 KB |
#include<cstdio>
#include<algorithm>
int a[2222][2222];
int main()
{
int i,j,n,r=0;
scanf("%d",&n);
for(i=0;i<n;i++)for(j=0;j<n;j++)scanf("%d",&a[i][j]);
i=j=0;
while(i!=n-1||j!=n-1)
{
if(i==n-1)
{
r+=std::max(a[i][j+1]-a[i][j]+1,0);
j++;
}
else if(j==n-1)
{
r+=std::max(a[i+1][j]-a[i][j]+1,0);
i++;
}
else
{
if(std::max(a[i][j+1]-a[i][j]+1,0)<std::max(a[i+1][j]-a[i][j]+1,0))
{
r+=std::max(a[i][j+1]-a[i][j]+1,0);
j++;
}
else if(std::max(a[i][j+1]-a[i][j]+1,0)>std::max(a[i+1][j]-a[i][j]+1,0))
{
r+=std::max(a[i+1][j]-a[i][j]+1,0);
i++;
}
else if(a[i][j+1]>a[i+1][j])
{
r+=std::max(a[i][j+1]-a[i][j]+1,0);
j++;
}
else
{
r+=std::max(a[i+1][j]-a[i][j]+1,0);
i++;
}
}
}
printf("%d",r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
20372 KB |
Output is correct |
2 |
Correct |
0 ms |
20372 KB |
Output is correct |
3 |
Correct |
0 ms |
20372 KB |
Output is correct |
4 |
Correct |
0 ms |
20372 KB |
Output is correct |
5 |
Correct |
0 ms |
20372 KB |
Output is correct |
6 |
Correct |
0 ms |
20372 KB |
Output is correct |
7 |
Correct |
0 ms |
20372 KB |
Output is correct |
8 |
Correct |
0 ms |
20372 KB |
Output is correct |
9 |
Correct |
0 ms |
20372 KB |
Output is correct |
10 |
Correct |
0 ms |
20372 KB |
Output is correct |
11 |
Correct |
0 ms |
20372 KB |
Output is correct |
12 |
Correct |
0 ms |
20372 KB |
Output is correct |
13 |
Correct |
0 ms |
20372 KB |
Output is correct |
14 |
Correct |
0 ms |
20372 KB |
Output is correct |
15 |
Correct |
0 ms |
20372 KB |
Output is correct |
16 |
Correct |
0 ms |
20372 KB |
Output is correct |
17 |
Correct |
0 ms |
20372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
20372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
20372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
584 ms |
20372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |