제출 #1259588

#제출 시각아이디문제언어결과실행 시간메모리
1259588kevinkleindyAwesome Arrowland Adventure (eJOI19_adventure)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m;
    int ans = 0;
    cin>>n>>m;
    for(int i = 0; i<n; i++){
        string s;
        cin>>s;
        for(int j = 0; j<m; j++){
            char cell = s[j];
            if(i!=n-1 && j!=m-1 && cell == 'X'){
                cout<<-1;
                return 0;
            }
            if(cell == 'N'){
                ans+=1;
            } else if (cell == 'E'){
                ans+=0;
            } else if (cell == 'S'){
                ans+=3;
            } else if (cell == 'W'){
                ans+=2;
            }
        }
    }

    cout<<ans;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...