Submission #750055

#TimeUsernameProblemLanguageResultExecution timeMemory
750055MuntherCarrotAwesome Arrowland Adventure (eJOI19_adventure)C++14
10 / 100
1 ms320 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define endl '\n'
#define all(x) x.begin(),x.end()
const ll MOD = 1e9 + 7, SZ = 1e5 + 10, INF = 1e18;
int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    char arr[n][m];
    int ans = 0;
    for(auto &i : arr){
        for(char &j : i){
            cin >> j;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m-1;j++){
            if(arr[i][j] == 'S')
                ans += 3;
            if(arr[i][j] == 'W')
                ans += 2;
            if(arr[i][j] == 'N')
                ans += 1;
            if(arr[i][j] == 'X')
                ans = -1;
        }
    }
    cout << ans;
    return 0;
}
#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...