Submission #844410


Source Code Expand

#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <ctime>
#include <fstream>
#include <cmath>
#include <unordered_map>

using namespace std;

#ifndef LOCAL
#define cerr if(0)cerr
#endif

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define RT fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock()/CLOCKS_PER_SEC);

typedef long long ll;
typedef long double ld;

const int INFint = 2e9;
const ll INF = 2e18;
const int MOD = 1e9 + 7;

#define FILE "palindrome"


int main() {
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
    //    freopen(FILE".in", "r", stdin); freopen(FILE".out", "w", stdout);
    //    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    string s;
    cin >> s;
    int x = 0, y = 0;
    for (auto c : s) {
        if (c == 'N') x--;
        if (c == 'S') x++;
        if (c == 'W') y++;
        if (c == 'E') y--;
        if (x == 0 && y == 0) {
            cout << "Yes\n";
            return 0;
        }

    }
    cout << "No\n";

    RT;
    return 0;
}

Submission Info

Submission Time
Task A - Wanna go back home
User qjex
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1334 Byte
Status WA
Exec Time 55 ms
Memory 764 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 4
AC × 14
WA × 1
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 13.txt, 15.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt AC 55 ms 764 KB
04.txt AC 4 ms 256 KB
05.txt AC 4 ms 256 KB
06.txt AC 4 ms 256 KB
07.txt AC 4 ms 256 KB
08.txt AC 4 ms 256 KB
09.txt AC 4 ms 256 KB
10.txt WA 4 ms 256 KB
11.txt AC 4 ms 256 KB
13.txt AC 4 ms 256 KB
15.txt AC 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB
s3.txt AC 4 ms 256 KB
s4.txt AC 4 ms 256 KB