Submission #1195830

#TimeUsernameProblemLanguageResultExecution timeMemory
1195830sheina906Awesome Arrowland Adventure (eJOI19_adventure)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
using namespace std;


int main()
{
    int n, m; cin >> n >> m;
    string s = "", t;
    while (--n) 
    {
        cin >> t;
        s += t;
    }
    int ans = 0;
    bool pos = true;
    for (char c : s) 
    {
        ans += (c == 'N' ? 2 : (c == 'E' || c == 'W' ? 1 : 0));
        if (c == 'X') pos = false;
    }

    cout << (pos ? ans : -1) << '\n';


    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...