This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |