# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
522212 |
2022-02-04T06:54:11 Z |
blue |
Nautilus (BOI19_nautilus) |
C++17 |
|
0 ms |
0 KB |
#include <iostream>
#include <bitset>
using namespace std;
const int mx = 10;
int main()
{
bitset<(mx+2) * (mx+2)> grid, DP0, DP1;
grid.reset();
int R, C, M;
cin >> R >> C >> M;
for(int i = 1; i <= R; i++)
{
for(int j = 1; j <= C; j++)
{
char c;
cin >> c;
if(c == '.')
grid.set((mx+2) * i + j);
}
}
// cerr << "\n";
// for(int i = 0; i < (mx+2)*(mx+2); i++)
// {
// cerr << grid[i] << ' ';
// if(i % (mx+2) == mx+1) cerr << '\n';
// }
string S;
cin >> S;
reverse(S.begin(), S.end());
DP0 = grid;
for(char c : S)
{
// cerr << "\n\n\n c = " << c << '\n';
DP1 = DP0;
// for(int i = 0; i < (mx+2)*(mx+2); i++)
// {
// cerr << DP1[i] << ' ';
// if(i % (mx+2) == mx+1) cerr << '\n';
// }
// cerr << "-----\n";
if(c == 'N') DP1 >>= (mx+2);
else if(c == 'S') DP1 <<= (mx+2);
else if(c == 'W') DP1 >>= 1;
else if(c == 'E') DP1 <<= 1;
DP1 &= grid;
// for(int i = 0; i < (mx+2)*(mx+2); i++)
// {
// cerr << DP1[i] << ' ';
// if(i % (mx+2) == mx+1) cerr << '\n';
// }
swap(DP0, DP1);
}
cout << DP0.count() << '\n';
}
Compilation message
nautilus.cpp: In function 'int main()':
nautilus.cpp:42:2: error: 'reverse' was not declared in this scope
42 | reverse(S.begin(), S.end());
| ^~~~~~~