Submission #975942

#TimeUsernameProblemLanguageResultExecution timeMemory
975942vjudge1Awesome Arrowland Adventure (eJOI19_adventure)C++17
22 / 100
1 ms348 KiB
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;

#define FUL(i, a, N) for(int i = a; i < N; i++)
#define FUE(i, a, N) for(int i = a; i <= N; i++)

int N, M;
ll ans;
char taman[502][502];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> N >> M;
    FUE(i, 1, N){
        FUE(j, 1, M){
            cin >> taman[i][j];
        }
    }
    FUE(i, 1, N){
        FUL(j, 1, M){
            if(taman[i][j] == 'X'){
                cout << -1;
                return 0;
            }
            if(taman[i][j] == 'E'){
                ans += 0;
            }else if(taman[i][j] == 'S'){
                ans += 3;
            }else if(taman[i][j] == 'W'){
                ans += 2;
            }else{
                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...