Submission #976098

# Submission time Handle Problem Language Result Execution time Memory
976098 2024-05-06T07:44:52 Z vjudge1 Awesome Arrowland Adventure (eJOI19_adventure) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
int main()
{
    int n, m;
    cin >> n >> m;
    int ans = 0;
    map<char, int> s;
    s['N'] = 1;
    s['E'] = 0;
    s['S'] = 3;
    s['W'] = 2;
    for (int i = 0; i < m; i++)
    {
        char x;
        cin >> x;
        if (i != m - 1)
        {
            if (x == 'X')
            {
                cout << -1 << endl;
                return;
            }
            else
            {
                ans += s[x];
            }
        }
    }
    cout << ans;

    // we can just uh,
}

Compilation message

adventure.cpp: In function 'int main()':
adventure.cpp:25:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   25 |                 return;
      |                 ^~~~~~