#include <bits/stdc++.h>
using namespace std;
bitset<255025> a, b;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, q;
cin >> n >> m >> q;
for (int i=0; i<n; i++)
{
for (int j=0; j<m; j++)
{
char x;
cin >> x;
a[i*505+j]=b[i*505+j]=x=='.';
}
}
for (int i=0; i<q; i++)
{
char x;
cin >> x;
if (x=='E')
b<<=1;
else if (x=='W')
b>>=1;
else if (x=='S')
b<<=505;
else if (x=='N')
b>>=505;
else
b=(b<<1)|(b>>1)|(b<<505)|(b>>505);
b&=a;
}
cout << b.count();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
548 KB |
Output is correct |
2 |
Correct |
2 ms |
548 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
548 KB |
Output is correct |
2 |
Correct |
2 ms |
548 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
552 KB |
Output is correct |
8 |
Correct |
3 ms |
468 KB |
Output is correct |
9 |
Correct |
3 ms |
468 KB |
Output is correct |
10 |
Correct |
3 ms |
468 KB |
Output is correct |
11 |
Correct |
2 ms |
468 KB |
Output is correct |
12 |
Correct |
3 ms |
548 KB |
Output is correct |
13 |
Correct |
4 ms |
468 KB |
Output is correct |
14 |
Correct |
3 ms |
468 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
3 ms |
468 KB |
Output is correct |
17 |
Correct |
4 ms |
468 KB |
Output is correct |
18 |
Correct |
4 ms |
468 KB |
Output is correct |
19 |
Correct |
5 ms |
468 KB |
Output is correct |
20 |
Correct |
5 ms |
548 KB |
Output is correct |
21 |
Correct |
4 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
548 KB |
Output is correct |
2 |
Correct |
2 ms |
548 KB |
Output is correct |
3 |
Correct |
2 ms |
552 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
552 KB |
Output is correct |
8 |
Correct |
3 ms |
468 KB |
Output is correct |
9 |
Correct |
3 ms |
468 KB |
Output is correct |
10 |
Correct |
3 ms |
468 KB |
Output is correct |
11 |
Correct |
2 ms |
468 KB |
Output is correct |
12 |
Correct |
3 ms |
548 KB |
Output is correct |
13 |
Correct |
4 ms |
468 KB |
Output is correct |
14 |
Correct |
3 ms |
468 KB |
Output is correct |
15 |
Correct |
3 ms |
468 KB |
Output is correct |
16 |
Correct |
3 ms |
468 KB |
Output is correct |
17 |
Correct |
4 ms |
468 KB |
Output is correct |
18 |
Correct |
4 ms |
468 KB |
Output is correct |
19 |
Correct |
5 ms |
468 KB |
Output is correct |
20 |
Correct |
5 ms |
548 KB |
Output is correct |
21 |
Correct |
4 ms |
468 KB |
Output is correct |
22 |
Correct |
79 ms |
844 KB |
Output is correct |
23 |
Correct |
86 ms |
852 KB |
Output is correct |
24 |
Correct |
78 ms |
808 KB |
Output is correct |
25 |
Correct |
75 ms |
820 KB |
Output is correct |
26 |
Correct |
77 ms |
852 KB |
Output is correct |
27 |
Correct |
137 ms |
832 KB |
Output is correct |
28 |
Correct |
130 ms |
852 KB |
Output is correct |
29 |
Correct |
133 ms |
828 KB |
Output is correct |
30 |
Correct |
146 ms |
832 KB |
Output is correct |
31 |
Correct |
129 ms |
828 KB |
Output is correct |
32 |
Correct |
193 ms |
828 KB |
Output is correct |
33 |
Correct |
177 ms |
828 KB |
Output is correct |
34 |
Correct |
219 ms |
852 KB |
Output is correct |
35 |
Correct |
179 ms |
828 KB |
Output is correct |
36 |
Correct |
173 ms |
832 KB |
Output is correct |