Submission #889752

#TimeUsernameProblemLanguageResultExecution timeMemory
889752vjudge1Nautilus (BOI19_nautilus)C++17
29 / 100
3 ms600 KiB
#include<bits/stdc++.h> #define pb push_back #define pf push_front #define F first #define S second #define ff first #define ss second #define ll long long #define ull unsigned long long #define ld long double #define pll pair<ll,ll> #define plll pair<ll,pll> #define pllll pair<pll,pll> #define vl vector<ll> #define vll vector<pll> #define vlll vector<plll> #define vllll vector<pllll> #define vb vector<bool> #define sz size() #define fr front() #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define bk back(); using namespace std; const ld pi=3.14159265359; const ll e5=1e5; const ll e6=1e6; const ll e9=1e9; const ll inf=1e18; const ll mod=1e9+7; const ll mod2=998244353; const ll N=1e5+5; ll bpm(ll x,ll y,ll m){if(y==0)return 1%m;if(y==1)return x%m;ll p=bpm(x,y/2,m); if(y%2==0)return p*p%m;else return p*p%m*x%m;} ll bp(ll x,ll y){if(y==0)return 1;if(y==1)return x;ll p=bp(x,y/2); if(y%2==0)return p*p;else return p*p*x;} void solve(/**/){ ll r,c,m,ans=0; string s; cin>>r>>c>>m; char a[r+1][c+1]; for(ll i=1;i<=r;i++){ for(ll j=1;j<=c;j++){ cin>>a[i][j]; } } cin>>s; reverse(all(s)); for(ll i=1;i<=r;i++){ for(ll j=1;j<=c;j++){ if(a[i][j]=='#') continue; ll x=i,y=j; bool ok=1; for(char ch:s){ if(ch=='N') x++; if(ch=='E') y--; if(ch=='S') x--; if(ch=='W') y++; if(x<1||x>r||y<1||y>c||a[x][y]=='#'){ok=0;break;} } if(ok) ans++; } } cout<<ans; return; } int main(/*Aldk*/){ ios_base::sync_with_stdio(false);cin.tie(NULL); //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); //cout<<setprecision(6)<<fixed; ll T=1; //cin>>T; for(ll i=1;i<=T;i++){ //cout<<"Case #"<<i<<": "; solve(); //cout<<'\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...