Submission #844501
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> P; #define EACH(i,a) for (auto& i : a) #define FOR(i,a,b) for (ll i=(a);i<(b);i++) #define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--) #define REP(i,n) for (ll i=0;i<(n);i++) #define RREP(i,n) for (ll i=(n)-1;i>=0;i--) #define debug(x) cout<<#x<<": "<<x<<endl #define pb push_back #define ALL(a) (a).begin(),(a).end() const ll linf = 1e18; const int inf = 1e9; const double eps = 1e-12; const double pi = acos(-1); template<typename T> istream& operator>>(istream& is, vector<T>& vec) { EACH(x,vec) is >> x; return is; } template<typename T> ostream& operator<<(ostream& os, vector<T>& vec) { REP(i,vec.size()) { if (i) os << " "; os << vec[i]; } return os; } template<typename T> ostream& operator<<(ostream& os, vector< vector<T> >& vec) { REP(i,vec.size()) { if (i) os << endl; os << vec[i]; } return os; } bool f(int a, int b) { return (!a && !b) || (a && b); } int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); string s; cin >> s; vector<int> cnt(26, 0); REP(i, s.size()) { cnt[s[i]]++; } if ( f(cnt['N'], cnt['S']) && f(cnt['E'], cnt['W']) ) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - Wanna go back home |
User | drafear |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1464 Byte |
Status | AC |
Exec Time | 11 ms |
Memory | 764 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
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 | 11 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 | 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 |