# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
171665 |
2019-12-29T19:37:33 Z |
Tc14 |
Nautilus (BOI19_nautilus) |
C++17 |
|
215 ms |
764 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<500> F[500], C[500], T[500];
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 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
504 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
504 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
17 |
Correct |
3 ms |
504 KB |
Output is correct |
18 |
Correct |
3 ms |
376 KB |
Output is correct |
19 |
Correct |
3 ms |
376 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
21 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
504 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
504 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
504 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
17 |
Correct |
3 ms |
504 KB |
Output is correct |
18 |
Correct |
3 ms |
376 KB |
Output is correct |
19 |
Correct |
3 ms |
376 KB |
Output is correct |
20 |
Correct |
3 ms |
504 KB |
Output is correct |
21 |
Correct |
3 ms |
376 KB |
Output is correct |
22 |
Correct |
99 ms |
724 KB |
Output is correct |
23 |
Correct |
103 ms |
764 KB |
Output is correct |
24 |
Correct |
97 ms |
632 KB |
Output is correct |
25 |
Correct |
97 ms |
760 KB |
Output is correct |
26 |
Correct |
97 ms |
760 KB |
Output is correct |
27 |
Correct |
159 ms |
632 KB |
Output is correct |
28 |
Correct |
166 ms |
632 KB |
Output is correct |
29 |
Correct |
166 ms |
504 KB |
Output is correct |
30 |
Correct |
160 ms |
632 KB |
Output is correct |
31 |
Correct |
157 ms |
632 KB |
Output is correct |
32 |
Correct |
215 ms |
716 KB |
Output is correct |
33 |
Correct |
208 ms |
760 KB |
Output is correct |
34 |
Correct |
214 ms |
760 KB |
Output is correct |
35 |
Correct |
208 ms |
720 KB |
Output is correct |
36 |
Correct |
206 ms |
724 KB |
Output is correct |