# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
522215 |
2022-02-04T07:15:24 Z |
blue |
Nautilus (BOI19_nautilus) |
C++17 |
|
2 ms |
460 KB |
#include <iostream>
#include <bitset>
#include <algorithm>
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());
while(1);
DP0 = grid;
for(char c : S)
{
// cerr << "\n\n\n c = " << c << '\n';
if(c == 'N') DP1 = (DP0 >> (mx+2));
else if(c == 'S') DP1 = (DP0 << (mx+2));
else if(c == 'W') DP1 = (DP0 >> 1);
else if(c == 'E') DP1 = (DP0 << 1);
else
{
DP1 = (DP0 << (mx+2)) | (DP0 >> (mx+2)) | (DP0 << 1) | (DP0 >> 1);
}
DP1 &= grid;
// for(int i = 0; i < (mx+2)*(mx+2); i++)
// {
// if(grid[i] == 0) cerr << "#";
// else cerr << DP0[i];
// if(i % (mx+2) == mx+1) cerr << '\n';
// }
// cerr << "\n---->\n";
// for(int i = 0; i < (mx+2)*(mx+2); i++)
// {
// if(grid[i] == 0) cerr << "#";
// else cerr << DP1[i];
// if(i % (mx+2) == mx+1) cerr << '\n';
// }
swap(DP0, DP1);
}
cout << DP0.count() << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |