Contest Duration: - (local time) (110 minutes) Back to Home

Submission #844505

Source Code Expand

Copy
```#include <bits/stdc++.h>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i <= (int)(n); ++i)
#define fore(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0; --i)
#define ford1(i, n) for(int i = (int)(n); i>=1; --i)
#define fored(i, a, b) for(int i = (int)(b); i >= (int)(a); --i)
#define sz(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define clr(v) memset(v, 0, sizeof(v))
#define clr1(v) memset(v, 0xFF, sizeof(v))
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef vector<pii> vpi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long i64;
typedef unsigned long long u64;
typedef long double ld;
typedef vector<ld> vld;

typedef vector<i64> vi64;

template<class T> bool uax(T&a, const T& b) { if( a < b ) { a = b; return true; } return false; }
template<class T> bool uin(T&a, const T& b) { if( a > b ) { a = b; return true; } return false; }

void solve() {
string s;
cin >> s;
bool ok = true;
for (string d: {"NS", "WE"}) {
int x[2] = {0, 0};
for (char c: s) {
x[0] += c == d[0];
x[1] += c == d[1];
}
if (x[0] > 0 || x[1] > 0) {
if (x[0] == 0 || x[1] == 0)
ok = false;
}
}
cout << (ok ? "Yes" : "No") << '\n';
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed; cout.precision(15);
cerr << fixed; cerr.precision(15);
#ifdef HOME
freopen("input.txt", "r", stdin);
#endif
solve();
return 0;
}
```

#### Submission Info

Submission Time 2016-08-21 21:03:56+0900 A - Wanna go back home gchebanov C++14 (GCC 5.4.1) 200 1670 Byte AC 4 ms 256 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
 AC × 4
 AC × 15
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 4 ms 256 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 AC 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