#include <iostream>
using namespace std;
const int N=20, M=20;
bool Matrixban(int x, int y, int n, int m)
{
return 0<=x && x<n && 0<=y && y<m;
}
bool keres(int x, int y, int celx, int cely, char lab[N][M])
{
if (x==celx && y==cely)
return true;
lab[x][y]='*';
if (Matrixban(x-1, y, celx+1, cely+1) && lab[x-1][y]=='.')
if (keres(x-1, y, celx, cely, lab))
return true;
if (Matrixban(x, y+1, celx+1, cely+1) && lab[x][y+1]=='.')
if (keres(x, y+1, celx, cely, lab))
return true;
if (Matrixban(x+1, y, celx+1, cely+1) && lab[x+1][y]=='.')
if (keres(x+1, y, celx, cely, lab))
return true;
if (Matrixban(x, y-1, celx+1, cely+1) && lab[x][y-1]=='.')
if (keres(x, y-1, celx, cely, lab))
return true;
return false;
}
int main()
{
int n, m;
cin>>n>>m;
char lab[N][M];
for (int i=0; i<n; i++)
for (int j=0; j<m; j++)
cin>>lab[i][j];
if (keres(0, 0, n-1, m-1, lab))
cout<<"igen";
else
cout<<"nem";
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1872 KiB | ||||
2 | Wrong answer | 3ms | 2068 KiB | ||||
subtask2 | 0/13 | ||||||
3 | Wrong answer | 3ms | 2312 KiB | ||||
4 | Wrong answer | 3ms | 2560 KiB | ||||
5 | Wrong answer | 3ms | 2696 KiB | ||||
6 | Wrong answer | 3ms | 2872 KiB | ||||
subtask3 | 0/22 | ||||||
7 | Wrong answer | 3ms | 3092 KiB | ||||
8 | Wrong answer | 4ms | 3304 KiB | ||||
9 | Wrong answer | 3ms | 3520 KiB | ||||
10 | Wrong answer | 3ms | 3580 KiB | ||||
11 | Wrong answer | 3ms | 3588 KiB | ||||
12 | Wrong answer | 3ms | 3704 KiB | ||||
13 | Wrong answer | 4ms | 3808 KiB | ||||
14 | Wrong answer | 4ms | 3896 KiB | ||||
subtask4 | 0/65 | ||||||
15 | Runtime error | 59ms | 5140 KiB | ||||
16 | Runtime error | 3ms | 5072 KiB | ||||
17 | Runtime error | 3ms | 5268 KiB | ||||
18 | Runtime error | 3ms | 5292 KiB | ||||
19 | Runtime error | 3ms | 5296 KiB | ||||
20 | Runtime error | 8ms | 5828 KiB | ||||
21 | Runtime error | 3ms | 5932 KiB | ||||
22 | Runtime error | 3ms | 5724 KiB | ||||
23 | Runtime error | 3ms | 6132 KiB | ||||
24 | Runtime error | 3ms | 5992 KiB |