# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1105365 | manhlinh1501 | Nautilus (BOI19_nautilus) | C++17 | 176 ms | 852 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MAXN = 505;
int N, M, K;
bitset<MAXN> a[MAXN];
bitset<MAXN> b[MAXN];
bitset<MAXN> c[MAXN];
void update(char x) {
if(x == 'N') {
for(int i = 1; i <= N; i++)
b[i] = a[i] & b[i + 1];
}
if(x == 'S') {
for(int i = N; i >= 1; i--)
b[i] = a[i] & b[i - 1];
}
if(x == 'E') {
for(int i = 1; i <= N; i++)
b[i] = a[i] & (b[i] << 1);
}
if(x == 'W') {
for(int i = N; i >= 1; i--)
b[i] = a[i] & (b[i] >> 1);
}
if(x == '?') {
for(int i = 1; i <= N; i++)
c[i] = b[i - 1] | b[i + 1] | (b[i] >> 1) | (b[i] << 1);
for(int i = 1; i <= N; i++)
b[i] = c[i] & a[i];
}
}
signed main() {
#define task ""
if(fopen(task".inp", "r")) {
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M >> K;
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= M; j++) {
char c = 0;
cin >> c;
if(c == '.') {
a[i].set(j);
b[i].set(j);
}
}
}
for(int i = 1; i <= K; i++) {
char x = 0;
cin >> x;
update(x);
}
int ans = 0;
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= M; j++) {
if(b[i][j])
ans++;
}
}
cout << ans;
return (0 ^ 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... |