| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1324999 | diana | Nautilus (BOI19_nautilus) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.H>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int r, c, m; cin >> r >> c >> m;
char p[r][c];
for(int i=0; i<r; i++)
for(int j=0; j<c; j++)
cin >> p[i][j];
string k; cin >> k;
int ans = 0;
for(int i=0; i<r; i++)
{
for(int j=0; j<c; j++)
{
if(p[i][j] == '#') continue;
int y = i, x = j, v = 1;
for(int cr=0; cr<m; cr++)
{
if(k[cr]=='E') x++;
else if(k[cr]=='W') x--;
else if(k[cr]=='N') y--;
else if(k[cr]=='S') y++;
if(!(0<=y && y<r && 0<=x && x<c) || p[y][x]=='#')
{
v = 0;
break;
}
}
ans += v;
}
}
cout << ans;
return 0;
}
