#include <iostream>
using namespace std;
int main()
{
int n,w,h;
cin>>n>>w>>h;
int x1=0,y1=0;
int x2=0,y2=0;
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
char c;
cin>>c;
if(c=='1')
{
x1=i;
y1=j;
}
else if(c=='2')
{
x2=i;
y2=j;
}
}
}
cout<<(x1!=x2)*(2-(x1==0 or x2==0 or x1==h-1 or x2==h-1))+(y1!=y2)*(2-(y1==0 or y2==0 or y1==w-1 or y2==w-1))<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |