# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
130975 | PeppaPig | Nautilus (BOI19_nautilus) | C++14 | 222 ms | 1016 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
const int M = 5e3+5;
int r, c, m;
char a[N][N], dir[M];
bitset<N> mask[N], dp[N];
int main() {
scanf("%d %d %d", &r, &c, &m);
for(int i = 0; i < r; i++) {
scanf(" %s", a[i]);
for(int j = 0; j < c; j++) {
if(a[i][j] == '#') mask[i][j] = dp[i][j] = 0;
else mask[i][j] = dp[i][j] = 1;
}
}
scanf(" %s", dir);
for(int i = 0; i < m; i++) {
bitset<N> ndp[N];
for(int j = 0; j < r; j++) ndp[j] = 0;
if(dir[i] == 'N' || dir[i] == '?') for(int j = 0; j < r - 1; j++)
ndp[j] |= dp[j + 1];
if(dir[i] == 'S' || dir[i] == '?') for(int j = 1; j < r; j++)
ndp[j] |= dp[j - 1];
if(dir[i] == 'W' || dir[i] == '?') for(int j = 0; j < r; j++)
ndp[j] |= dp[j] >> 1;
if(dir[i] == 'E' || dir[i] == '?') for(int j = 0; j < r; j++)
ndp[j] |= dp[j] << 1;
for(int j = 0; j < r; j++) dp[j] = ndp[j] & mask[j];
}
int ans = 0;
for(int i = 0; i < r; i++) ans += dp[i].count();
printf("%d\n", ans);
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... |