Submission #679754

#TimeUsernameProblemLanguageResultExecution timeMemory
679754Valera_GrinenkoNautilus (BOI19_nautilus)C++17
29 / 100
1 ms424 KiB
// #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define ppb pop_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin()) typedef long long ll; typedef long double ld; using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; } template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; } void solve() { int r, c, m; cin >> r >> c >> m; bitset<500> kek[500], init[500]; for(int i = 0; i < r; i++) { for(int j = 0; j < c; j++) { char cl; cin >> cl; init[i][j] = (cl == '.'); } kek[i] = init[i]; } char move; for(int mv = 0; mv < m; mv++) { cin >> move; if(move == 'N') { for(int i = 0; i + 1 < r; i++) kek[i] = (init[i] & kek[i + 1]); kek[r - 1].reset(); } else if(move == 'W') { for(int i = 0; i < r; i++) kek[i] = (init[i] & (kek[i] >> 1)); } else if(move == 'S') { for(int i = r - 1; i > 0; i--) kek[i] = (init[i] & kek[i - 1]); kek[0].reset(); } else if(move == 'E') { for(int i = 0; i < r; i++) kek[i] = (init[i] & (kek[i] << 1)); } } int ans = 0; for(int i = 0; i < r; i++) ans += kek[i].count(); cout << ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while(t--) solve(); return 0; } /* 5 9 7 ...##.... ..#.##..# ..#....## .##...#.. ....#.... WS?EE?? first sub */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...