# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
171664 |
2019-12-29T19:36:15 Z |
Tc14 |
Nautilus (BOI19_nautilus) |
C++17 |
|
4 ms |
760 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define Inf INT32_MAX
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
int main() {
ios_base::sync_with_stdio(false);
int r, c, m, ans;
char t, d;
bitset<9> F[5], C[5], T[5];
cin >> r >> c >> m;
for (int i = 0; i < r; i++) {
for (int j = 0; j < c; j++) {
cin >> t;
if (t == '.') {
F[i].set(j);
C[i].set(j);
}
}
}
for (int i = 0; i < m; i++) {
cin >> d;
switch (d) {
case 'N':
for (int i = 0; i < r - 1; i++) C[i] = C[i + 1] & F[i];
C[r - 1].reset();
break;
case 'S':
for (int i = r - 1; i > 0; i--) C[i] = C[i - 1] & F[i];
C[0].reset();
break;
case 'W':
for (int i = 0; i < r; i++) C[i] = (C[i] >> 1) & F[i];
break;
case 'E':
for (int i = 0; i < r; i++) C[i] = (C[i] << 1) & F[i];
break;
default:
for (int i = 0; i < r; i++) T[i].reset();
for (int i = 0; i < r - 1; i++) T[i] |= C[i + 1];
for (int i = r - 1; i > 0; i--) T[i] |= C[i - 1];
for (int i = 0; i < r; i++) T[i] |= C[i] >> 1;
for (int i = 0; i < r; i++) T[i] |= C[i] << 1;
for (int i = 0; i < r; i++) C[i] = T[i] & F[i];
break;
}
}
ans = 0;
for (int i = 0; i < r; i++) {
ans += C[i].count();
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
760 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
760 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
760 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |