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 futaba ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rio return 0;
// Fun things are fun. //
char c[505][505];
int main() {
/* freopen(".txt", "r", stdin);
freopen(".txt", "w", stdout); */
futaba
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
cin >> c[i][j];
}
}
if(n == 1) {
int idx = -1;
for(int i = 1; i <= m; i++) {
if(c[1][i] == 'X') {
idx = i;
break;
}
}
int ans = 0;
if(idx != m) ans = -1;
else {
for(int i = 1; i <= m; i++) {
if(c[1][i] == 'N') ans++;
else if(c[1][i] == 'S') ans += 3;
else if(c[1][i] == 'W') ans += 2;
}
}
cout << ans << '\n';
rio
}
rio
}
# | 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... |