| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 748391 | vjudge1 | Nautilus (BOI19_nautilus) | C++17 | 1 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <bitset>
using namespace std;
const int MAXN = 1005;
const int MAXM = 1005;
const int MAXLEN = 1005;
const int MAXDIRS = 4;
const int DR[MAXDIRS] = {-1, 0, 1, 0};
const int DC[MAXDIRS] = {0, 1, 0, -1};
int N, M;
bitset<MAXN*MAXM> can_submarine_be_here, possible_locations;
int main() {
cin >> N >> M;
for (int i = 0; i < N; ++i) {
string line;
cin >> line;
for (int j = 0; j < M; ++j) {
if (line[j] == '.') {
can_submarine_be_here.set(i*M+j);
possible_locations.set(i*M+j);
}
}
}
string signals;
cin >> signals;
for (int i = 0; i < signals.size(); ++i) {
char d = signals[i];
if (d == 'N') d = 0;
else if (d == 'E') d = 1;
else if (d == 'S') d = 2;
else if (d == 'W') d = 3;
else continue;
bitset<MAXN*MAXM> new_possible_locations;
for (int j = possible_locations._Find_first(); j != possible_locations.size(); j = possible_locations._Find_next(j)) {
int r = j / M;
int c = j % M;
int nr = r + DR[d];
int nc = c + DC[d];
if (nr >= 0 && nr < N && nc >= 0 && nc < M && can_submarine_be_here[nr*M+nc]) {
new_possible_locations.set(nr*M+nc);
}
}
possible_locations = new_possible_locations;
}
cout << possible_locations.count()-2;
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... | ||||
