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 <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pll pair<ll, ll>
char a[505][505];
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll n, m, cnt = 0;
cin>>n>>m;
for (ll i = 1; i<=n; i++){
for (ll j = 1; j<=m; j++){
cin>>a[i][j];
}
}
for (ll i = 1; i<=m-1; i++){
if (a[i][1] == 'X'){
cnt = -1;
break;
}
if (a[i][1] == 'N') cnt += 2;
else if (a[i][1] == 'W') cnt++;
else if (a[i][1] == 'S') cnt += 3;
}
cout<<cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |