| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1324516 | husseinjuanda | Nautilus (BOI19_nautilus) | C++20 | 105 ms | 804 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int r, c, m; cin >> r >> c >> m;
vector<string> x(r);
for(int i = 0; i < r; i++){
cin >> x[i];
}
vector<bitset<500>> j(r);
vector<bitset<500>> s(r);
for(int i = 0; i < r; i++){
for(int y = 0; y < c; y++){
if(x[i][y] == '.'){
j[i][y] = 1;
s[i][y] = 1;
}
}
}
string q; cin >> q;
for(auto c : q){
vector<bitset<500>> n_s(r);
if(c == 'N'){
for(int y = 0; y < r; y++){
if(y-1 >= 0){
n_s[y-1] |= s[y];
}
}
swap(n_s, s);
}
if(c == 'S'){
for(int y = 0; y < r; y++){
if(y+1 < r){
n_s[y+1] |= s[y];
}
}
swap(n_s, s);
}
if(c == 'W'){
for(int y = 0; y < r; y++){
s[y]>>=1;
}
}
if(c == 'E'){
for(int y = 0; y < r; y++){
s[y]<<=1;
}
}
if(c == '?'){
for(int y = 0; y < r; y++){
n_s[y]|=(s[y]<<1);
n_s[y]|=(s[y]>>1);
if(y-1 >= 0){
n_s[y-1] |= s[y];
}
if(y+1 < r){
n_s[y+1] |= s[y];
}
}
swap(s, n_s);
}
for(int y = 0; y < r; y++){
s[y]&=j[y];
}
}
int ns = 0;
for(int i = 0; i < r; i++){
ns += s[i].count();
}
cout << ns << "\n";
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
