제출 #1151556

#제출 시각아이디문제언어결과실행 시간메모리
1151556tntNautilus (BOI19_nautilus)C++20
0 / 100
2 ms320 KiB
#include <bits/stdc++.h> using namespace std; //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") #define pb push_back #define ll long long #define all(v) v.begin(),v.end() int mod = 1e8; const int N = 1e6; const int inf = 2e9; int was[300][300]; signed main(){ //freopen("shuffle.in", "r", stdin); //freopen("shuffle.out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); int n,m,d; cin >> n >> m >> d; char a[n + 1][m + 1]; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cin >> a[i][j]; } } string s; cin >> s; for(int t = 0; t < s.size(); t++){ for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(a[i][j] == '#' || was[i][j] == 1) continue; if(s[t] == 'E'){ if(j + 1 > m || a[i][j + 1] == '#') was[i][j] = 1; } else if(s[t] == 'W'){ if(j - 1 < 1 || a[i][j - 1] == '#') was[i][j] = 1; } else if(s[t] == 'N'){ if(i - 1 < 1 || a[i - 1][j] == '#') was[i][j] = 1; } else{ if(i + 1 > n || a[i + 1][j] == '#') was[i][j] = 1; } } } } int ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(a[i][j] == '#' || was[i][j] == 1) continue; ans++; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...