Submission #1190173

#TimeUsernameProblemLanguageResultExecution timeMemory
1190173AzeTurk810Nautilus (BOI19_nautilus)C++20
100 / 100
236 ms776 KiB
// Telebe of adicto yani AzeTurk810
//
// WHY ARE YOU STARING MY CODE Stranger ??!!
//
//GO AWAY AND DON T look my CODE if i don t know you or you are stalker !!!!(hrrr)
//
// here about me: I am alone of course, fun , ' , ' , love pyhcics , young(child) , love music , had birds , not a gamer , chess :) , dead to football , you are looking to code , ... ;
//
// why at 1 japon army march they say "the enemy geniral is a hero , an equal to no one. Both in glory and in victory
// the men that follow him are also breave , fearless wariors ..."?
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

# define int ll
# define ln '\n'
# define INFi 1e9
# define INFll 1e18
# define MOD 998244353
# define maxN 251010
# define K 64


bitset<maxN> st , can;

void solve() {
    int r , c , m;
    cin >> r >> c >> m;
    string s;
    int cur = 0;
    for(int i = 0 ; i < r ; i ++) {
        can[cur] = 0;
        cur++;
        for(int j = 0 ; j < c ; j ++) {
            char x;
            cin >> x;
            can[cur] = (x == '.');
            cur++;
        }
        can[cur] = 0;
        cur++;
    }
    st = can;
    cin >> s;
    for(char &cr:s) {
        if(cr == 'N') {
            st >>= c + 2;
        } else if(cr == 'W') {
            st >>= 1;
        } else if(cr == 'S') {
            st <<= c + 2;
        } else if(cr == 'E') {
            st <<= 1;
        } else {
            st = (st >> 1)|(st << 1)|(st<<(c+2))|(st>>(c+2));
        }
        st&=can;
    }
    cout << st.count() << ln;
}


signed main() {
    int t = 1;
    while(t--)solve();
}
/*

*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...