제출 #1151952

#제출 시각아이디문제언어결과실행 시간메모리
1151952thecrazycandyNautilus (BOI19_nautilus)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") using namespace std; #define sped_up ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long const ll INF = (ll)1e9 + 1, INFL = (ll)1e18 + 1; const ll mod = (ll)1e9 + 7, MAXN = (ll)501; bitset <MAXN> nw[MAXN]; bitset <MAXN> bt[MAXN]; bitset <MAXN> h[MAXN]; int main () { sped_up; ll n, m, k; cin >> n >> m >> k; ll cnt = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { char a; cin >> a; bt[i][j] = 1; if (a == '.') h[i][j] = 1; } } for (int i = 1; i <= k; i++) { char c; cin >> c; for (int j = 1; j <= n; j++) { if ('W' == c) nw[j] = (bt[j] >> 1); else if ('E' == c) nw[j] = (bt[j] << 1); else if ('N' == c) nw[j] = bt[j - 1]; else if ('S' == c) nw[j] = bt[j + 1]; else nw[j] = ((bt[j] << 1) | (bt[j] >> 1)) | (bt[j - 1] | bt[j + 1]); nw[j] &= h[j]; } for (int j = 1; j <= n; j++) { bt[j] = nw[j]; } } for (int i = 1; i <= n; i++) { for (int j = 0; j <= m; j++) { cnt += bt[i][j]; } } cout << cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...