This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,m,k,l,r,u,d,cnt;
int main() {
cin>>n>>m>>k;
string s;
char map[200][200];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>map[i][j];
}
}
cin>>s;
for(int i=0;i<k;i++){
if(s[i]=='N'){
u++;
}
if(s[i]=='S'){
d++;
}
if(s[i]=='W'){
l++;
}
else if(s[i]=='E'){
r++;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(map[i-l+r][j-u+d]=='.'){
cnt++;
}
}
}
cout<<cnt;
}
//ee pon
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |