0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 22:58:48 +00:00

#3202. 「BalticOI 2019 Day1」潜艇

https://loj.ac/s/1629036
This commit is contained in:
Baoshuo Ren 2022-11-10 20:12:48 +08:00
parent 978cd55503
commit 035b647bb8
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
75 changed files with 289 additions and 0 deletions

67
LibreOJ/3202/3202.cpp Normal file
View File

@ -0,0 +1,67 @@
#include <iostream>
#include <array>
#include <bitset>
#include <numeric>
#include <string>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 505,
M = 5005;
int r, c, m, p;
std::string s;
std::array<std::bitset<N>, N> f[M], g;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> r >> c >> m;
for (int i = 1; i <= r; i++) {
for (int j = 1; j <= c; j++) {
char ch;
cin >> ch;
g[i].set(j, ch == '.');
}
}
cin >> s;
f[0] = g;
for (char op : s) {
p++;
if (op == 'N') {
for (int i = 1; i <= r; i++) {
f[p][i] = (f[p - 1][i + 1]) & g[i];
}
} else if (op == 'E') {
for (int i = 1; i <= r; i++) {
f[p][i] = (f[p - 1][i] << 1) & g[i];
}
} else if (op == 'S') {
for (int i = 1; i <= r; i++) {
f[p][i] = (f[p - 1][i - 1]) & g[i];
}
} else if (op == 'W') {
for (int i = 1; i <= r; i++) {
f[p][i] = (f[p - 1][i] >> 1) & g[i];
}
} else { // op == '?'
for (int i = 1; i <= r; i++) {
f[p][i] = ((f[p - 1][i] >> 1) | (f[p - 1][i] << 1) | f[p - 1][i - 1] | f[p - 1][i + 1]) & g[i];
}
}
}
cout << std::accumulate(f[m].begin(), f[m].end(), 0, [](int x, auto y) -> int { return x + y.count(); }) << endl;
return 0;
}

BIN
LibreOJ/3202/data/input0.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input1.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input10.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input11.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input12.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input13.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input14.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input15.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input16.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input17.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input18.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input19.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input2.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input20.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input21.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input22.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input23.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input24.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input25.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input26.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input27.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input28.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input29.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input3.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input30.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input31.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input32.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input33.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input34.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input35.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input36.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input4.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input5.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input6.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input7.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input8.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/input9.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output0.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output1.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output10.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output11.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output12.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output13.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output14.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output15.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output16.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output17.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output18.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output19.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output2.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output20.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output21.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output22.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output23.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output24.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output25.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output26.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output27.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output28.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output29.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output3.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output30.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output31.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output32.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output33.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output34.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output35.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output36.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output4.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output5.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output6.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output7.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output8.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3202/data/output9.txt (Stored with Git LFS) Normal file

Binary file not shown.