이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
const int N=1e6+500;
const int off=(1<<18);
const int MOD = 1e9+7;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,m;
cin >> m >> n;
int tot=0;
for(int i=0;i<n;i++){
char ch;cin >> ch;
if(ch=='N')tot++;
if(ch=='W')tot+=2;
if(ch=='S')tot+=3;
if(ch=='X'&&i!=n-1)tot-=INT_MAX;
}
if(tot<0)tot=-1;
cout<<tot;
}
# | 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... |