이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int m, n;
cin >> m >> n;
string s[m];
for(int i = 0; i < m; i++) {
cin >> s[i];
}
map<pair<char, char>, int> M;
M[{'N', 'E'}] = 1;
M[{'E', 'S'}] = 1;
M[{'S', 'W'}] = 1;
M[{'W', 'N'}] = 1;
M[{'N', 'S'}] = 2;
M[{'E', 'W'}] = 2;
M[{'S', 'N'}] = 2;
M[{'W', 'E'}] = 2;
M[{'N', 'W'}] = 3;
M[{'E', 'N'}] = 3;
M[{'S', 'E'}] = 3;
M[{'W', 'S'}] = 3;
if(m == 1) {
bool w = 1;
int S = 0;
for(int i = 0; i < n - 1; i++) {
if(s[0][i] == 'X') {
w = 0;
break;
}
if(s[0][i] != 'E') {
S += M[{s[0][i], 'E'}];
}
}
cout << (w ? S : -1) << '\n';
}
return 0;
}
# | 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... |