| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1329279 | flo | Nautilus (BOI19_nautilus) | C++20 | 215 ms | 158564 KiB |
#include <bits/stdc++.h>
#define task "treasure"
#define ll long long
#define multitest 0
using namespace std;
const int N = 500, K = 5000;
bitset<N+5> a[N+5], dp[K+5][N+5];
void flo(int ID) {
int n, m, k; cin >> n >> m >> k;
for (int x = 0; x < n; x++) {
for (int y = 0; y < m; y++) {
char c; cin >> c;
if (c == '.') {
a[x].set(y), dp[0][x].set(y);
}
}
}
for (int i = 1; i <= k; i++) {
char c; cin >> c;
if (c == 'E' || c == '?') {
for (int x = 0; x < n; x++) {
dp[i][x] |= dp[i-1][x]<<1;
}
}
if (c == 'W' || c == '?') {
for (int x = 0; x < n; x++) {
dp[i][x] |= dp[i-1][x]>>1;
}
}
if (c == 'S' || c == '?') {
for (int x = 1; x < n; x++) {
dp[i][x] |= dp[i-1][x-1];
}
}
if (c == 'N' || c == '?') {
for (int x = 0; x < n-1; x++) {
dp[i][x] |= dp[i-1][x+1];
}
}
for (int x = 0; x < n; x++) {
dp[i][x] &= a[x];
}
}
int ans = 0;
for (int x = 0; x < n; x++) {
ans += dp[k][x].count();
}
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int TCS = 1, ID = 1;
if (multitest) {
cin >> TCS;
}
while (TCS--) flo(ID++);
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
