Submission #1305868
Source Code Expand
import java.io.*; import java.math.*; import java.util.*; public class Main { private static boolean debug = false; private static boolean elapsed = false; private static PrintWriter _out = new PrintWriter(System.out); private static PrintWriter _err = new PrintWriter(System.err); private void solve(Scanner sc) { String S = sc.nextLine(); boolean n = false; boolean s = false; boolean w = false; boolean e = false; for (int i = 0; i < S.length(); ++i) { char ch = S.charAt(i); switch (ch) { case 'N': n = true; break; case 'S': s = true; break; case 'W': w = true; break; case 'E': e = true; break; } } if (s && n && w && e || s && n && !w && !e || !s && !n && w && e) { _out.println("Yes"); } else { _out.println("No"); } } private static BigInteger C(long n, long r) { BigInteger res = BigInteger.ONE; for (long i = n; i > n - r; --i) { res = res.multiply(BigInteger.valueOf(i)); } for (long i = r; i > 1; --i) { res = res.divide(BigInteger.valueOf(i)); } return res; } private static BigInteger P(long n, long r) { BigInteger res = BigInteger.ONE; for (long i = n; i > n - r; --i) { res = res.multiply(BigInteger.valueOf(i)); } return res; } /* * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9 * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18 */ public static void main(String[] args) { long S = System.currentTimeMillis(); Scanner sc = new Scanner(System.in); new Main().solve(sc); _out.flush(); long G = System.currentTimeMillis(); if (elapsed) { _err.println((G - S) + "ms"); } _err.flush(); } }
Submission Info
Submission Time | |
---|---|
Task | A - Wanna go back home |
User | unirita135 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 2211 Byte |
Status | AC |
Exec Time | 102 ms |
Memory | 21844 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 | 101 ms | 18900 KB |
04.txt | AC | 90 ms | 21588 KB |
05.txt | AC | 90 ms | 21844 KB |
06.txt | AC | 93 ms | 19284 KB |
07.txt | AC | 102 ms | 18772 KB |
08.txt | AC | 91 ms | 19796 KB |
09.txt | AC | 102 ms | 20564 KB |
10.txt | AC | 91 ms | 18772 KB |
11.txt | AC | 92 ms | 21332 KB |
13.txt | AC | 102 ms | 20560 KB |
15.txt | AC | 92 ms | 21716 KB |
s1.txt | AC | 90 ms | 21844 KB |
s2.txt | AC | 92 ms | 17492 KB |
s3.txt | AC | 91 ms | 18644 KB |
s4.txt | AC | 89 ms | 21716 KB |