s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time int64 0 100 | memory stringlengths 4 6 | code_size int64 15 14.7k | code stringlengths 15 14.7k | problem_id stringlengths 6 6 | problem_description stringlengths 358 9.83k | input stringlengths 2 4.87k | output stringclasses 807
values | __index_level_0__ int64 1.1k 1.22M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s671612523 | p04015 | u310678820 | 1556909927 | Python | Python (3.4.3) | py | Accepted | 36 | 6004 | 382 | n, a =map(int, input().split())
x=list(map(int, input().split()))
x=[i-a for i in x]
memo=[[-1]*6000 for i in range(60)]
def dp(k, value):
if k==n:
if value==0:
return 1
else:
return 0
if memo[k][value]>=0:
return memo[k][value]
memo[k][value]=dp(k+1, value+x[... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,971 |
s017523312 | p04015 | u371467115 | 1554508284 | Python | Python (3.4.3) | py | Accepted | 27 | 3188 | 192 | n,a=map(int, input().split())
x=list(map(int, input().split()))
x=[i-a for i in x]
d={0:1}
for i in x:
for j,k in list(d.items()):
d[i+j]=d.get(i+j,0)+k
print(d[0]-1)
#sample code. | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,972 |
s010686712 | p04015 | u118642796 | 1554216501 | Python | Python (3.4.3) | py | Accepted | 27 | 3188 | 199 | N,A = map(int,input().split())
X = [int(x)-A for x in input().split()]
d = {0:1}
for x in X:
d_tmp = d.copy()
for k in d_tmp:
d[k+x] = d.get(k+x,0)+d_tmp[k]
print(d[0]-1)
| p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,973 |
s561802122 | p04015 | u118642796 | 1554215858 | Python | Python (3.4.3) | py | Accepted | 38 | 3316 | 649 | N,A = map(int,input().split())
X = [int(x)-A for x in input().split()]
z = 0
dic = {}
for x in X:
if x==0:
z += 1
else:
dic[x] = dic.get(x,0) + 1
line = {}
line[0] = 1
for k in dic:
line_k = {}
for i in range(dic[k]+1):
line_k[k*i] = 1
for j in ... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,974 |
s100973000 | p04015 | u810735437 | 1549500629 | Python | Python (3.4.3) | py | Accepted | 58 | 5680 | 1,697 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 終了後に自力AC
#
# カードを「Aより小さい」「Aに等しい」「Aより大きい」に分ける。
#
# 「Aより小さい」カードで「和がSになる組み合わせの数」は容易に計算できる。
# 「Aより大きい」カードで「和がTになる組み合わせの数」も計算できる。
#
# あとはこれらを組み合わせるだけ
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import ma... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,975 |
s657227229 | p04015 | u810735437 | 1549500232 | Python | Python (3.4.3) | py | Accepted | 73 | 7212 | 1,328 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ありえる平均は1..50のいずれか
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys
N, A = map(int, input().split())
Xs = list(sorted(map(int, input().split())... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,976 |
s478349871 | p04015 | u133038626 | 1547093901 | Python | Python (3.4.3) | py | Accepted | 24 | 3064 | 785 | # coding: utf-8
II = lambda: int(input())
MI = lambda: map(int, input().split())
def sumcnt(values):
sc = [0] * (50 * 50 + 1)
sc[0] = 1
max_sc = 0
for v in values:
for i in range(max_sc, -1, -1):
sc[i + v] += sc[i]
max_sc += v
return sc, max_sc
def main():
N, A =... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,977 |
s462636316 | p04015 | u620480037 | 1546712392 | Python | Python (3.4.3) | py | Accepted | 46 | 3064 | 400 | N,A=map(int,input().split())
X=list(map(int,input().split()))
x=[]
for i in range(N):
x.append(X[i]-A)
L=[0 for i in range(5001)]
L[2500]=1
for i in range(N):
if x[i]>=0:
for j in range(5001):
if L[5000-j]>0:
L[5000-j+x[i]]+=L[5000-j]
elif x[i]<0:
for j in rang... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,978 |
s690952107 | p04015 | u368780724 | 1543586394 | Python | Python (3.4.3) | py | Accepted | 26 | 3572 | 261 | from collections import defaultdict
H = defaultdict(lambda: 0)
H[0] = 1
def inpl(): return [int(i) for i in input().split()]
N, A = inpl()
x = inpl()
x = [i-A for i in x]
H[0]= 1
for i in x:
for ni,nv in H.copy().items():
H[ni+i] += nv
print(H[0]-1) | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,979 |
s627079072 | p04015 | u404676457 | 1542680720 | Python | Python (3.4.3) | py | Accepted | 25 | 3188 | 1,028 | (n, a) = list(map(int, input().split()))
x = list(map(int, input().split()))
plus = []
minus = []
zero = 0
for i in range(n):
x[i] -= a
if x[i] > 0:
plus.append(x[i])
elif x[i] < 0:
minus.append(x[i])
else:
zero += 1
map_plus = {}
map_minus = {}
for i in plus:
tmp_map = ma... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,980 |
s906598283 | p04015 | u064408584 | 1540524906 | Python | Python (3.4.3) | py | Accepted | 25 | 3188 | 178 | n,a=map(int, input().split())
x=list(map(int, input().split()))
x=[i-a for i in x]
d={0:1}
for i in x:
for j,k in list(d.items()):
d[i+j]=d.get(i+j,0)+k
print(d[0]-1) | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,981 |
s908534421 | p04015 | u177398299 | 1536974632 | Python | Python (3.4.3) | py | Accepted | 62 | 5364 | 354 | from collections import defaultdict
N, A = map(int, input().split())
x = list(map(lambda x: int(x) - A, input().split()))
# dp[i][j]: i番目, j合計
dp = [defaultdict(int) for _ in range(N + 1)]
dp[0][0] = 1
for i in range(N):
for key in dp[i]:
dp[i + 1][key + x[i]] += dp[i][key]
dp[i + 1][key] += dp[i]... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,982 |
s372562642 | p04015 | u574050882 | 1533430534 | Python | Python (3.4.3) | py | Accepted | 23 | 4084 | 1,135 | def main():
t = input().split(" ")
N, A= int(t[0]), int(t[1])
t = input().split(" ")
x_p = []
x_n = []
x_z = 0
for i in t:
i = int(i)
if A < i:
x_p.append(i - A)
elif i < A:
x_n.append(A - i)
else:
x_z += 1
x_p.sort()
... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,983 |
s165170241 | p04015 | u856232850 | 1532385435 | Python | Python (3.4.3) | py | Accepted | 26 | 3188 | 194 | n,a = map(int, input().split())
x = list(map(int,input().split()))
x = [i-a for i in x]
d = {}
d[0] = 1
for i in x:
for j,k in list(d.items()):
d[j+i] = d.get(j+i,0)+k
print(d[0]-1) | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,984 |
s912895106 | p04015 | u482969053 | 1529861010 | Python | Python (3.4.3) | py | Accepted | 26 | 3572 | 298 | from collections import defaultdict
N, A = list(map(int, input().split()))
x = list(map(int, input().split()))
x = [x - A for x in x]
counter = defaultdict(int)
counter[0] = 1
for x_i in x:
copy = dict(counter)
for d, c in copy.items():
counter[d+x_i] += c
print(counter[0]-1)
| p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,985 |
s199219336 | p04015 | u536081558 | 1529368140 | Python | Python (2.7.6) | py | Accepted | 61 | 2948 | 204 | n, a = map(int, raw_input().split())
f = [0 for i in range(6000)]
f[0] = 1
for x in map(int, raw_input().split()):
x -= a
g = f[::]
for i in range(-3000, 3000):
g[i + x] += f[i]
f = g
print g[0] - 1 | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,986 |
s173996054 | p04015 | u792078574 | 1515560363 | Python | Python (3.4.3) | py | Accepted | 31 | 3188 | 240 | N, A = map(int, input().split())
X = list(map(int, input().split()))
for i in range(N):
X[i] -= A
X.sort()
p = { 0: 1 }
for x in X:
for n, count in list(p.items()):
if n+x <= 0:
p[n+x] = p.get(n+x, 0) + count
print(p[0] - 1) | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,987 |
s052836700 | p04015 | u800610991 | 1498868991 | Python | Python (3.4.3) | py | Accepted | 26 | 3188 | 251 | # coding: utf-8
n, a = map(int, input().split())
l_a = list(map(lambda x: int(x) - a, input().split()))
dic = dict()
dic[0] = 1
for x in l_a:
for key, value in list(dic.items()):
dic[x + key] = value + dic.get(x+key,0)
print(dic[0] - 1)
| p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,988 |
s354048200 | p04015 | u243492642 | 1490730156 | Python | Python (3.4.3) | py | Accepted | 26 | 3188 | 335 | # coding: utf-8
num_N, num_A = map(int, input().split())
l_card = list(map(int, input().split()))
l_card_ave = [i - num_A for i in l_card]
dict_ans = dict()
dict_ans[0] = 1
for card in l_card_ave:
for key, value in list(dict_ans.items()):
dict_ans[key + card] = dict_ans.get(key + card, 0) + value
print(d... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,989 |
s330248048 | p04015 | u243492642 | 1490305204 | Python | Python (3.4.3) | py | Accepted | 26 | 3572 | 313 | # coding: utf-8
from collections import defaultdict
num_card, num_ave = map(int, input().split())
l_card = map(lambda x: int(x) - num_ave, input().split())
counter = defaultdict(int)
counter[0] = 1
for card in l_card:
for d, c in list(counter.items()):
counter[d + card] += c
print(counter[0] - 1) | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,990 |
s951761000 | p04015 | u382423941 | 1472494313 | Python | Python (3.4.3) | py | Accepted | 54 | 3188 | 202 | N, A = map(int, input().split())
xs = map(lambda x: int(x) - A, input().split())
d = dict()
d[0] = 1
for x in xs:
for s, v in list(d.items()):
d[s + x] = d.get(s + x, 0) + v
print(d[0]-1)
| p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,991 |
s107722043 | p04015 | u707500405 | 1472441183 | Python | Python (2.7.6) | py | Accepted | 67 | 4996 | 322 | def solve():
N,A = map(int,raw_input().split())
x = map(int,raw_input().split())
ofs = N*50; M = ofs*2 + 1
DP = [[0]*M for i in xrange(N+1)]
DP[0][ofs] = 1
for i in xrange(N):
for j in xrange(M):
if DP[i][j] == 0: continue
DP[i+1][j+x[i]-A] += DP[i][j]
DP[i+1][j] += DP[i][j]
print DP[N][ofs] - 1
solve... | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,992 |
s210189610 | p04015 | u707500405 | 1472440091 | Python | Python (2.7.6) | py | Accepted | 50 | 5112 | 304 | from collections import defaultdict
def solve():
N,A = map(int,raw_input().split())
x = map(int,raw_input().split())
DP = [defaultdict(int) for i in xrange(N+1)]
DP[0][0] = 1
for i in xrange(N):
for k,v in DP[i].iteritems():
DP[i+1][k+x[i]-A] += v
DP[i+1][k] += v
print DP[N][0] - 1
solve() | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,993 |
s320271144 | p04015 | u327466606 | 1472439006 | Python | Python (3.4.3) | py | Accepted | 55 | 3572 | 252 |
from collections import defaultdict
N, A = map(int, input().split())
X = map(lambda s: int(s) - A, input().split())
counter = defaultdict(int)
counter[0] = 1
for x in X:
for d,c in list(counter.items()):
counter[d+x] += c
print(counter[0]-1) | p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,994 |
s019168700 | p04015 | u478870821 | 1472438178 | Python | Python (3.4.3) | py | Accepted | 55 | 3188 | 246 | from sys import exit
def reads():
return [int(x) for x in input().split()]
(N, A) = reads()
x = reads()
d = dict()
d[0] = 1
for i in range(N):
for (s, N) in list(d.items()):
k = s + x[i] - A
d[k] = d.get(k, 0) + N
print(d[0]-1)
| p04015 | <span class="lang-en">
<p>Score : <var>300</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Tak has <var>N</var> cards. On the <var>i</var>-th <var>(1 \leq i \leq N)</var> card is written an integer <var>x_i</var>.
He is selecting one or more cards from these <var>N</var> cards, so that the av... | 4 8
7 9 8 9
| 5
| 1,199,995 |
s229353393 | p04016 | u677523557 | 1569773390 | Python | Python (3.4.3) | py | Accepted | 52 | 3188 | 655 | import math
N = int(input())
S = int(input())
L = N-S
def search(b, n=N):
ans = 0
while n >= b:
ans += n%b
n //= b
ans += n
return ans
def main():
if L < 0:
print(-1)
elif L == 0:
print(N+1)
else:
P = []
for l in range(1, int(math.sqrt(L))... | p04016 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>For integers <var>b (b \geq 2)</var> and <var>n (n \geq 1)</var>, let the function <var>f(b,n)</var> be defined as follows:</p>
<ul>
<li><var>f(b,n) = n</var>, when <var>n < b</var></li>
<li><var>f(b... | 87654
30
| 10
| 1,199,996 |
s295453626 | p04016 | u844789719 | 1557802643 | Python | Python (3.4.3) | py | Accepted | 43 | 3700 | 749 | import collections
N = int(input())
S = int(input())
def prime_decomposition(n):
i = 2
ret = collections.defaultdict(int)
while i * i <= n:
while n % i == 0:
n //= i
ret[i] += 1
i += 1
if n > 1:
ret[n] = 1
return ret
def digitsum(x, f):
if x < ... | p04016 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>For integers <var>b (b \geq 2)</var> and <var>n (n \geq 1)</var>, let the function <var>f(b,n)</var> be defined as follows:</p>
<ul>
<li><var>f(b,n) = n</var>, when <var>n < b</var></li>
<li><var>f(b... | 87654
30
| 10
| 1,199,997 |
s785934984 | p04016 | u844789719 | 1557802344 | Python | Python (3.4.3) | py | Accepted | 43 | 3700 | 761 | import collections
N = int(input())
S = int(input())
if N == S:
print(N + 1)
exit()
def prime_decomposition(n):
i = 2
ret = collections.defaultdict(int)
while i * i <= n:
while n % i == 0:
n //= i
ret[i] += 1
i += 1
if n > 1:
ret[n] = 1
retu... | p04016 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>For integers <var>b (b \geq 2)</var> and <var>n (n \geq 1)</var>, let the function <var>f(b,n)</var> be defined as follows:</p>
<ul>
<li><var>f(b,n) = n</var>, when <var>n < b</var></li>
<li><var>f(b... | 87654
30
| 10
| 1,199,998 |
s169157971 | p04016 | u218843509 | 1549915474 | Python | Python (3.4.3) | py | Accepted | 73 | 3188 | 446 | from math import sqrt
import sys
sys.setrecursionlimit(10**6)
def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + n % b
n = int(input())
s = int(input())
if n < s:
print(-1)
elif n == s:
print(n+1)
else:
divs = []
for i in range(1, int(sqrt(n-s))+1):
if (n-s)%i == 0:
divs.append(i)
if i != (... | p04016 | <span class="lang-en">
<p>Score : <var>500</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>For integers <var>b (b \geq 2)</var> and <var>n (n \geq 1)</var>, let the function <var>f(b,n)</var> be defined as follows:</p>
<ul>
<li><var>f(b,n) = n</var>, when <var>n < b</var></li>
<li><var>f(b... | 87654
30
| 10
| 1,199,999 |
s709151322 | p04019 | u924828749 | 1601434975 | Python | Python (3.8.2) | py | Accepted | 23 | 8988 | 261 | s = input()
flag = [0] * 4
for i in range(len(s)):
if s[i] == "N":
flag[0] = 1
elif s[i] == "S":
flag[1] = 1
elif s[i] == "W":
flag[2] = 1
else:
flag[3] = 1
if flag[0] == flag[1] and flag[2] == flag[3]:
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,000 |
s195568379 | p04019 | u785573018 | 1601434860 | Python | Python (3.8.2) | py | Accepted | 25 | 8984 | 157 | s = input(); a = b = c = d = 0
if "N" in s: a = 1
if "W" in s: b = 1
if "S" in s: c = 1
if "E" in s: d = 1
print("Yes") if a == c and b == d else print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,001 |
s926155160 | p04019 | u244434589 | 1601428082 | Python | Python (3.8.2) | py | Accepted | 25 | 9000 | 300 | s = input()
if 'E' in s:
if 'W' not in s:
print('No')
exit()
if 'E' not in s:
if 'W' in s:
print('No')
exit()
if 'N' not in s:
if 'S' in s:
print('No')
exit()
if 'N' in s:
if 'S' not in s:
print('No')
exit()
print('Yes') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,002 |
s376574212 | p04019 | u629540524 | 1601402095 | Python | PyPy3 (7.3.0) | py | Accepted | 66 | 61360 | 105 | s= list(set(input()))
print('No' if s.count('N')!=s.count('S') or s.count("W") !=s.count('E') else 'Yes') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,003 |
s808608461 | p04019 | u629540524 | 1601402082 | Python | Python (3.8.2) | py | Accepted | 26 | 8960 | 105 | s= list(set(input()))
print('No' if s.count('N')!=s.count('S') or s.count("W") !=s.count('E') else 'Yes') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,004 |
s924355851 | p04019 | u257162238 | 1601248826 | Python | Python (3.8.2) | py | Accepted | 28 | 9296 | 423 | import sys
input = sys.stdin.readline
from collections import Counter
def read():
S = input().strip()
return S,
def solve(S):
D = Counter(S)
if D["N"] != 0 and D["S"] == 0 or D["N"] == 0 and D["S"] != 0:
return "No"
if D["E"] != 0 and D["W"] == 0 or D["E"] == 0 and D["W"] != 0:
r... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,005 |
s526229005 | p04019 | u422272120 | 1601153069 | Python | Python (3.8.2) | py | Accepted | 29 | 9112 | 278 | s = input()
if ("N" in s and "S" in s) and ("W" in s and "E" in s):
print ("Yes")
elif ("N" in s and "S" in s) and (not "W" in s and not "E" in s):
print ("Yes")
elif (not "N" in s and not "S" in s) and ("W" in s and "E" in s):
print ("Yes")
else:
print ("No")
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,006 |
s484205981 | p04019 | u598684283 | 1600971334 | Python | Python (3.8.2) | py | Accepted | 29 | 9132 | 376 | s = input()
check = [0]*4
for i in range(len(s)):
if s[i] == "N" and check[0] == 0:
check[0] = 1
if s[i] == "S" and check[1] == 0:
check[1] = 1
if s[i] == "W" and check[2] == 0:
check[2] = 1
if s[i] == "E" and check[3] == 0:
check[3] = 1
if check[0] == check[1] and chec... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,007 |
s178656823 | p04019 | u666550725 | 1600961443 | Python | PyPy3 (7.3.0) | py | Accepted | 62 | 62036 | 241 | S = input()
A = [0, 0, 0, 0]
for i in range(len(S)):
if S[i] == "N":
A[0] = 1
elif S[i] == "S":
A[1] = 1
elif S[i] == "E":
A[2] = 1
else:
A[3] = 1
if A[0] ^ A[1] == A[2] ^ A[3] == 0:
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,008 |
s134948866 | p04019 | u626337957 | 1600952339 | Python | Python (3.8.2) | py | Accepted | 25 | 9056 | 220 | S = input()
s_set = set()
for s in S:
s_set.add(s)
if len(s_set) == 4:
print('Yes')
elif len(s_set) == 2 and (('W' in s_set and 'E' in s_set) or \
('S' in s_set and 'N' in s_set)):
print('Yes')
else:
print('No')
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,009 |
s482817176 | p04019 | u500376440 | 1600880283 | Python | PyPy3 (7.3.0) | py | Accepted | 61 | 62012 | 272 | import sys
def input():
return sys.stdin.readline().rstrip()
ma={"N":0,"S":0,"E":0,"W":0}
def func(S):
for x in S:
ma[x]=1
if ma["N"]!=ma["S"]:
return False
if ma["W"]!=ma["E"]:
return False
return True
S=input()
print("Yes" if func(S) else "No")
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,010 |
s470149684 | p04019 | u740157634 | 1600825941 | Python | Python (3.8.2) | py | Accepted | 27 | 9056 | 223 | S = input()
n = S.count('N')
s = S.count('S')
w = S.count('W')
e = S.count('E')
a = 0
if n > 0:
a += 1
if s > 0:
a -= 1
if w > 0:
a += 2
if e > 0:
a -= 2
if a == 0:
print("Yes")
else:
print("No")
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,011 |
s173489387 | p04019 | u353548710 | 1600789009 | Python | Python (3.8.2) | py | Accepted | 28 | 9096 | 221 | S = input()
n = S.count('N')
s = S.count('S')
w = S.count('W')
e = S.count('E')
d = 0
if n > 0:
d += 1
if s > 0:
d -= 1
if w > 0:
d += 2
if e > 0:
d -= 2
if d == 0:
ans = 'Yes'
else:
ans = 'No'
print(ans) | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,012 |
s247101838 | p04019 | u301302814 | 1600527336 | Python | Python (3.8.2) | py | Accepted | 26 | 9124 | 374 | # coding: utf-8
def main():
S = input()
dic = {'N':0, 'S':0, 'E':0, 'W':0}
ans = 'No'
for s in S:
dic[s] += 1
if (dic['N'] == 0 and dic['S'] == 0) or (dic['N'] > 0 and dic['S'] > 0):
if (dic['E'] == 0 and dic['W'] == 0) or (dic['E'] > 0 and dic['W'] > 0):
ans = 'Yes'
... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,013 |
s312750505 | p04019 | u572032237 | 1600508327 | Python | Python (3.8.2) | py | Accepted | 27 | 9020 | 114 | s = input()
d = [c in s for c in 'NSEW']
if d[0] == d[1] and d[2] == d[3]:
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,014 |
s071925593 | p04019 | u752774573 | 1600493579 | Python | PyPy3 (7.3.0) | py | Accepted | 63 | 61808 | 120 | S=input()
n=('N' in S)
s=('S' in S)
w=('W' in S)
e=('E' in S)
if not n^s and not w^e:
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,015 |
s058333838 | p04019 | u318427318 | 1600480531 | Python | Python (3.8.2) | py | Accepted | 33 | 9096 | 454 | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
#方角が南北/東西でセットであればよさげ
s = input().rstrip()
s = set(s)
WE={'W','E'}
NS={'N','S'}
all_direction={'N', 'E', 'S', 'W'}
if s == set(WE):
print("Yes")
elif s == set(NS):
print("Yes")
elif s == set(all_d... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,016 |
s760837741 | p04019 | u397496203 | 1600477631 | Python | PyPy3 (7.3.0) | py | Accepted | 70 | 65264 | 581 | import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
def main():
from collections import defaultdict
S = list(input())
d = defaultdict(int)
for s... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,017 |
s091527342 | p04019 | u317423698 | 1600402074 | Python | Python (3.8.2) | py | Accepted | 31 | 9028 | 772 | import sys
def resolve(in_):
S = next(in_).strip()
H = None
W = None
for c in S:
if c == 'N':
if H == 'S':
H = False
elif H is None:
H = c
elif c == 'S':
if H == 'N':
H = False
elif H ... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,018 |
s565730842 | p04019 | u495667483 | 1600392965 | Python | Python (3.8.2) | py | Accepted | 32 | 9436 | 473 | import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7
def input():
return sys.stdin.readline()[:-1]
def mi():
return map(int, input().split())
def ii():
return int(input())
def i2(n):
tmp = [list(mi()) for i in range(n)]
return ... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,019 |
s972190786 | p04019 | u022215787 | 1600297274 | Python | Python (3.8.2) | py | Accepted | 29 | 8984 | 257 | s = input()
x = False
if 'N' in s and 'S' in s:
x = True
if 'N' not in s and 'S' not in s:
x = True
y = False
if 'W' in s and 'E' in s:
y = True
if 'W' not in s and 'E' not in s:
y = True
if x and y:
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,020 |
s874216841 | p04019 | u796563423 | 1600284771 | Python | Python (3.8.2) | py | Accepted | 28 | 9064 | 288 | s=input()
a=s.count("N")
b=s.count("W")
c=s.count("S")
d=s.count("E")
ans=False
if a!=0 and c!=0:
if (b!=0 and d!=0) or (b==0 and d==0):
ans=True
if a==0 and c==0:
if (b!=0 and d!=0) or (b==0 and d==0):
ans=True
if ans==True:
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,021 |
s506717961 | p04019 | u883621917 | 1600021500 | Python | PyPy3 (7.3.0) | py | Accepted | 63 | 61832 | 294 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
s = input().strip()
if ('N' in s and 'S' not in s) or ('N' not in s and 'S' in s):
print('No')
sys.exit(0)
if ('W' in s and 'E' not in s) or ('W' not in s and 'E' in s):
print('No')
sys.exit(0)
print('Yes')
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,022 |
s512929914 | p04019 | u460745860 | 1600010036 | Python | Python (3.8.2) | py | Accepted | 30 | 9332 | 363 | # A
from collections import Counter
S = list(input())
count = Counter(S)
flag = True
if count['N'] > 0:
if count['S'] == 0:
flag = False
if count['S'] > 0:
if count['N'] == 0:
flag = False
if count['E'] > 0:
if count['W'] == 0:
flag = False
if count['W'] > 0:
if count['E'] == 0:
flag = False
pr... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,023 |
s773011150 | p04019 | u248670337 | 1599975957 | Python | Python (3.8.2) | py | Accepted | 28 | 9104 | 65 | print('YNeos'[set(input())not in map(set,['NS','EW','NEWS'])::2]) | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,024 |
s876774453 | p04019 | u825186577 | 1599932409 | Python | Python (3.8.2) | py | Accepted | 29 | 9052 | 279 | S = input()
set_ = set()
for i in S:
set_.add(i)
if len(set_) == 4:
print("Yes")
elif len(set_) == 2:
if 'N' in set_ and 'S' in set_:
print("Yes")
elif 'E' in set_ and 'W' in set_:
print("Yes")
else:
print("No")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,025 |
s851762081 | p04019 | u468972478 | 1599702929 | Python | Python (3.8.2) | py | Accepted | 27 | 8972 | 95 | a = set(input())
print("Yes" if a == set("NEWS") or a == set("NS") or a == set("EW") else "No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,026 |
s009842567 | p04019 | u888092736 | 1599668709 | Python | Python (3.8.2) | py | Accepted | 31 | 9396 | 297 | from collections import Counter
cntr = Counter(input())
x_ok, y_ok = False, False
if (cntr["E"] and cntr["W"]) or (not cntr["E"] and not cntr["W"]):
x_ok = True
if (cntr["N"] and cntr["S"]) or (not cntr["N"] and not cntr["S"]):
y_ok = True
print("Yes") if x_ok and y_ok else print("No")
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,027 |
s929204932 | p04019 | u760760982 | 1599661988 | Python | Python (3.8.2) | py | Accepted | 29 | 9032 | 220 | s = input()
s,n,e,w = s.count("S"),s.count("N"),s.count("E"),s.count("W")
if (s > 0 and n == 0) or (s == 0 and n > 0):
print("No")
elif (e > 0 and w == 0) or (e == 0 and w > 0):
print("No")
else:
print("Yes") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,028 |
s076279670 | p04019 | u156815136 | 1599653985 | Python | Python (3.8.2) | py | Accepted | 40 | 10368 | 1,214 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Cou... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,029 |
s563823297 | p04019 | u670567845 | 1599651810 | Python | PyPy3 (7.3.0) | py | Accepted | 72 | 61848 | 269 | S = list(input())
flag = True
if "N" in S:
if "S" not in S:
flag = False
if "S" in S:
if "N" not in S:
flag = False
if "E" in S:
if "W" not in S:
flag = False
if "W" in S:
if "E" not in S:
flag = False
if flag:
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,030 |
s713780764 | p04019 | u241159583 | 1599651539 | Python | Python (3.8.2) | py | Accepted | 29 | 9064 | 236 | s = sorted(list(set(input())))
if len(s) == 1 or len(s)==3: ans = "No"
elif len(s) == 2 or len(s)==4:
if s == ["N","S"] or s == ["E", "W"]: ans = "Yes"
elif s == ["E", "N", "S", "W"]: ans = "Yes"
else: ans = "No"
print(ans) | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,031 |
s302396210 | p04019 | u843175622 | 1599651516 | Python | Python (3.8.2) | py | Accepted | 32 | 9408 | 155 | from collections import Counter
s = Counter(input())
if (s['N'] > 0) ^ (s['S'] > 0) or (s['E'] > 0) ^ (s['W'] > 0):
print('No')
else:
print('Yes')
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,032 |
s637721701 | p04019 | u644907318 | 1599651340 | Python | PyPy3 (7.3.0) | py | Accepted | 65 | 62024 | 343 | S = input().strip()
C = {"N":0,"S":0,"E":0,"W":0}
for i in range(len(S)):
C[S[i]] += 1
if C["N"]>0 and C["S"]>0 and C["E"]>0 and C["W"]>0 or C["N"]==0 and C["S"]==0 and C["E"]>0 and C["W"]>0\
or C["N"]>0 and C["S"]>0 and C["E"]==0 and C["W"]==0 or C["N"]==0 and C["S"]==0 and C["E"]==0 and C["W"]==0:
print("Yes"... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,033 |
s377180402 | p04019 | u536034761 | 1599651324 | Python | Python (3.8.2) | py | Accepted | 27 | 8992 | 196 | S = input()
n = S.count("N")
s = S.count("S")
w = S.count("W")
e = S.count("E")
if (n == s == 0 or (n > 0 and s > 0)) and (w == e == 0 or (w > 0 and e > 0)):
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,034 |
s785192086 | p04019 | u359358631 | 1599620365 | Python | PyPy3 (7.3.0) | py | Accepted | 62 | 61936 | 365 | def main():
s = input()
n_cnt = s.count("N")
w_cnt = s.count("W")
s_cnt = s.count("S")
e_cnt = s.count("E")
if (n_cnt == 0 and s_cnt == 0) or (n_cnt > 0 and s_cnt > 0):
if (w_cnt == 0 and e_cnt == 0) or (w_cnt > 0 and e_cnt > 0):
print("Yes")
exit()
print("... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,035 |
s330073995 | p04019 | u776311944 | 1599593729 | Python | Python (3.8.2) | py | Accepted | 23 | 9024 | 356 | S = list(input())
Ncnt, Ecnt, Wcnt, Scnt = 0, 0, 0, 0
for i in S:
if i == 'N':
Ncnt += 1
elif i == 'E':
Ecnt += 1
elif i == 'W':
Wcnt += 1
else:
Scnt += 1
if (Ncnt > 0 and Scnt == 0) or (Scnt > 0 and Ncnt == 0) or (Ecnt > 0 and Wcnt == 0) or (Wcnt > 0 and Ecnt == 0):
... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,036 |
s609202447 | p04019 | u554784585 | 1599381871 | Python | Python (3.8.2) | py | Accepted | 31 | 9048 | 326 | S=input()
n=0
s=0
w=0
e=0
for i in range(len(S)):
if S[i]=="N":
n+=1
if S[i]=="S":
s+=1
if S[i]=="W":
w+=1
if S[i]=="E":
e+=1
if n!=0 and s!=0 and w!=0 and e!=0 or n==0 and s==0 and w!=0 and e!=0 or n!=0 and s!=0 and w==0 and e==0:
print("Yes")
else:
print("No")... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,037 |
s881292204 | p04019 | u710515311 | 1599348285 | Python | PyPy3 (7.3.0) | py | Accepted | 71 | 61776 | 276 | def solve():
S = input()
n = S.count('N')
e = S.count('E')
w = S.count('W')
s = S.count('S')
if (n and not s) or (not n and s) or (e and not w) or (not e and w):
print('No')
else:
print('Yes')
if __name__ == "__main__":
solve() | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,038 |
s826613661 | p04019 | u405660020 | 1599332024 | Python | Python (3.8.2) | py | Accepted | 29 | 9016 | 320 | s=input()
if s.count("N")>0 and s.count("W")>0 and s.count("S")>0 and s.count("E")>0:
print("Yes")
elif s.count("N")==0 and s.count("W")>0 and s.count("S")==0 and s.count("E")>0:
print("Yes")
elif s.count("N")>0 and s.count("W")==0 and s.count("S")>0 and s.count("E")==0:
print("Yes")
else:
print("No")
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,039 |
s767223630 | p04019 | u125545880 | 1599275460 | Python | Python (3.8.2) | py | Accepted | 30 | 9412 | 317 | import collections
def main():
S = list(input())
Sset = set(S)
if len(Sset) in [1, 3]:
print('No')
elif Sset == set(['S', 'N']) or Sset == set(['W', 'E']):
print('Yes')
elif len(Sset) == 4:
print('Yes')
else:
print('No')
if __name__ == "__main__":
main()
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,040 |
s115268691 | p04019 | u456353530 | 1599251345 | Python | PyPy3 (7.3.0) | py | Accepted | 71 | 61740 | 225 | S = input()
L = [0] * 4
for s in S:
if s == "N":
L[0] = 1
elif s == "S":
L[1] = 1
elif s == "E":
L[2] = 1
elif s == "W":
L[3] = 1
if L[0] == L[1] and L[2] == L[3]:
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,041 |
s499489210 | p04019 | u244416763 | 1599120912 | Python | Python (3.8.2) | py | Accepted | 31 | 8976 | 265 | s = list(input())
s = list(set(s))
flag = True
if "N" in s and not "S" in s:
flag = False
if "S" in s and not "N" in s:
flag = False
if "E" in s and not "W" in s:
flag = False
if "W" in s and not "E" in s:
flag = False
print("Yes" if flag else "No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,042 |
s403616328 | p04019 | u883040023 | 1599077386 | Python | Python (3.8.2) | py | Accepted | 30 | 9360 | 168 | s = list(set(list(input())))
ans = "Yes"
import collections
c = collections.Counter(s)
if c["N"] + c["S"] == 1 or c["W"] + c["E"] == 1:
ans = "No"
print(ans) | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,043 |
s636342142 | p04019 | u583507988 | 1599062221 | Python | Python (3.8.2) | py | Accepted | 27 | 9076 | 327 | s=input()
n=len(s)
if s.count('N')!=0 and s.count('S')!=0 and s.count('E')!=0 and s.count('W')!=0:
print('Yes')
elif s.count('N')!=0 and s.count('S')!=0 and s.count('E')==0 and s.count('W')==0:
print('Yes')
elif s.count('N')==0 and s.count('S')==0 and s.count('E')!=0 and s.count('W')!=0:
print('Yes')
else:
prin... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,044 |
s455221521 | p04019 | u418826171 | 1599000520 | Python | Python (3.8.2) | py | Accepted | 26 | 9120 | 327 | import sys
s = input()
if 'N' in s:
if 'S' not in s:
print('No')
sys.exit()
if 'W' in s:
if 'E' not in s:
print('No')
sys.exit()
if 'E' in s:
if 'W' not in s:
print('No')
sys.exit()
if 'S' in s:
if 'N' not in s:
print('No')
sys.exit()
print... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,045 |
s791066779 | p04019 | u795844873 | 1598925116 | Python | Python (3.8.2) | py | Accepted | 29 | 9120 | 258 | s = input()
if (
(('N' in s) and ('S' in s) and (not 'W' in s) and (not 'E' in s)) or
(('W' in s) and ('E' in s) and (not 'N' in s) and (not 'S' in s)) or
(('N' in s) and ('S' in s) and ('W' in s) and ('E' in s))
):
print('Yes')
else:
print('No')
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,046 |
s581246548 | p04019 | u395620499 | 1598924628 | Python | Python (3.8.2) | py | Accepted | 29 | 8992 | 299 | t = input()
n = False
s = False
e = False
w = False
for i in range(len(t)):
n = n or t[i] == 'N'
s = s or t[i] == 'S'
e = e or t[i] == 'E'
w = w or t[i] == 'W'
ok = True
ok = (n and s) or (not n and not s)
ok = ok and ((e and w) or (not e and not w))
print('Yes' if ok else 'No')
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,047 |
s728216152 | p04019 | u306412379 | 1598812207 | Python | Python (3.8.2) | py | Accepted | 31 | 8948 | 347 | x = list(input())
if 'N' in x and 'S' in x:
if 'E' in x and 'W' in x:
print('Yes')
elif 'E' not in x and 'W' not in x:
print('Yes')
else:
print('No')
elif 'N' not in x and 'S' not in x:
if 'E' in x and 'W' in x:
print('Yes')
elif 'E' not in x and 'W' not in x:
print('Yes')
else:
prin... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,048 |
s347001509 | p04019 | u249987458 | 1598771026 | Python | Python (3.8.2) | py | Accepted | 30 | 9128 | 212 | S = str(input())
n = S.count('N')
w = S.count('W')
s = S.count('S')
e = S.count('E')
if (n == 0 and 0 < s) or (s == 0 and 0 < n) or (e == 0 and 0 < w) or (w == 0 and 0 < e):
print('No')
else:
print('Yes') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,049 |
s063378745 | p04019 | u840037795 | 1598500716 | Python | PyPy3 (7.3.0) | py | Accepted | 64 | 61772 | 234 | S=input()
hasN = S.find('N') >= 0
hasS = S.find('S') >= 0
hasE = S.find('E') >= 0
hasW = S.find('W') >= 0
if (hasN and hasS or not hasN and not hasS) and (hasE and hasW or not hasE and not hasW):
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,050 |
s447680720 | p04019 | u512551187 | 1598469130 | Python | PyPy3 (7.3.0) | py | Accepted | 67 | 61856 | 388 | s=input()
x,y=0,0
li=s
if 'N' in li and 'S' in li and not 'E' in li and not 'W' in li:
print('Yes')
exit()
if 'E' in li and 'W' in li and not 'S' in li and not 'N' in li:
print('Yes')
exit()
for i in s:
if(i=='N'):
y+=1
elif(i=='S'):
y-=1
elif(i=='W'):
x-=1
else:
... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,051 |
s633543911 | p04019 | u005977014 | 1598463506 | Python | Python (3.8.2) | py | Accepted | 28 | 9092 | 410 | li = list(map(str, input()))
x=0
y=0
if 'N' in li and 'S' in li and not 'E' in li and not 'W' in li:
print('Yes')
exit()
if 'E' in li and 'W' in li and not 'S' in li and not 'N' in li:
print('Yes')
exit()
for i in range(len(li)):
if li[i]=='N':
x=x+1
elif li[i]=='S':
x=x-1
elif li[i]=='E':
... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,052 |
s524344270 | p04019 | u465652095 | 1598454079 | Python | Python (3.8.2) | py | Accepted | 26 | 9016 | 251 | N = input()
NS = set(N)
if len(N) == 1 or len(NS) == 1:
print("No")
elif "N" not in N and "S" not in N or "W" not in N and "E" not in N :
print("Yes")
elif "N" in N and "W" in N and "E" in N and "S" in N:
print("Yes")
else:
print("No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,053 |
s744392887 | p04019 | u972474792 | 1598406391 | Python | PyPy3 (7.3.0) | py | Accepted | 61 | 61768 | 228 | S=list(input())
if 'N' in S and 'S' not in S:
print('No')
elif 'S' in S and 'N' not in S:
print('No')
elif 'W' in S and 'E' not in S:
print('No')
elif 'E' in S and 'W' not in S:
print('No')
else:
print('Yes') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,054 |
s482305394 | p04019 | u720558413 | 1598367376 | Python | Python (3.8.2) | py | Accepted | 29 | 9084 | 346 | S = input()
if S.count('N') >= 1 and S.count('S') >= 1 and S.count('E') == 0 and S.count('W') == 0:
print('Yes')
elif S.count('E') >= 1 and S.count('W') >= 1 and S.count('N') == 0 and S.count('S') == 0:
print('Yes')
elif S.count('E') >= 1 and S.count('W') >= 1 and S.count('N') >= 1 and S.count('S') >= 1:
print('... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,055 |
s285993934 | p04019 | u536017058 | 1598215251 | Python | PyPy3 (7.3.0) | py | Accepted | 68 | 61472 | 194 | S = list(set(list(input())))
S.sort()
ans = "No"
if S[0] == 'E':
if S[-1] == 'W':
if len(S)==2 or len(S)==4:
ans = "Yes"
if S[0] == 'N':
if S[-1] == 'S':
ans = "Yes"
print(ans) | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,056 |
s245280314 | p04019 | u314188085 | 1598204242 | Python | Python (3.8.2) | py | Accepted | 29 | 9060 | 229 | s=input()
ok = True
if s.count('N')*s.count('S')==0 and s.count('N')+s.count('S')!=0:
ok=False
if s.count('W')*s.count('E')==0 and s.count('W')+s.count('E')!=0:
ok=False
if ok:
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,057 |
s171532412 | p04019 | u177125607 | 1598093762 | Python | Python (3.8.2) | py | Accepted | 27 | 8988 | 123 | S = set(input())
if S == {'W', 'E', 'N', 'S'} or S == {'W', 'E'} or S == {'N', 'S'}:
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,058 |
s929292324 | p04019 | u972658925 | 1597899556 | Python | Python (3.8.2) | py | Accepted | 23 | 8996 | 178 | s = list(set(list(input())))
if len(s)%2 == 0:
if ("N" in s and"S" in s) or ("E" in s and "W" in s):
print('Yes')
else:
print('No')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,059 |
s035664854 | p04019 | u519339498 | 1597865776 | Python | Python (3.8.2) | py | Accepted | 26 | 8980 | 400 | '''
Created on 2020/08/19
@author: harurun
'''
def main():
import sys
pin=sys.stdin.readline
pout=sys.stdout.write
perr=sys.stderr.write
S=pin()[:-1]
T=list(set(S))
if len(T)==4:
print("Yes")
elif len(T)==3 or len(T)==1:
print("No")
else:
if (("N" in S )and ("S" in S)) or (("W" in S) a... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,060 |
s300739339 | p04019 | u319245933 | 1597804191 | Python | Python (3.8.2) | py | Accepted | 27 | 9132 | 300 | *S, = input()
flag_x = False
flag_y = False
if 'S' in S and 'N' in S:
flag_y = True
if 'S' not in S and 'N' not in S:
flag_y = True
if 'E' in S and 'W' in S:
flag_x = True
if 'E' not in S and 'W' not in S:
flag_x = True
if flag_x and flag_y:
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,061 |
s209600187 | p04019 | u556589653 | 1597802436 | Python | Python (3.8.2) | py | Accepted | 31 | 9124 | 345 | S = input()
if S.count("S") >= 1 and S.count("W") >= 1 and S.count("E") >= 1 and S.count("N") >= 1:
print("Yes")
elif S.count("S") >= 1 and S.count("W") == 0 and S.count("E") == 0 and S.count("N") >= 1:
print("Yes")
elif S.count("S") == 0 and S.count("W") >= 1 and S.count("E") >= 1 and S.count("N") == 0:
print("Y... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,062 |
s959161994 | p04019 | u125348436 | 1597800396 | Python | Python (3.8.2) | py | Accepted | 30 | 8980 | 569 | s = input()
def walk(s):
ls = len(s)
nc = 0
sc = 0
wc = 0
ec = 0
l=[]
for i in range(ls):
if s[i] == "W":
wc += 1
l.append(wc)
elif s[i] == "E":
ec += 1
l.append(ec)
elif s[i] == "N":
nc += 1
l.... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,063 |
s045798571 | p04019 | u860002137 | 1597800031 | Python | Python (3.8.2) | py | Accepted | 31 | 9072 | 201 | s = input()
ans1 = (("S" in s) and ("N" in s)) or (("S" not in s) and ("N" not in s))
ans2 = (("E" in s) and ("W" in s)) or (("E" not in s) and ("W" not in s))
print("Yes" if ans1 and ans2 else "No") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,064 |
s093364538 | p04019 | u028973125 | 1597800015 | Python | Python (3.8.2) | py | Accepted | 31 | 9360 | 617 | import sys
from collections import Counter
tmp = sys.stdin.readline().strip()
directions = ""
pre = ""
for c in tmp:
if c == pre:
continue
directions += c
pre = c
counter = Counter(directions)
# print(counter)
d = {"S": 0, "E": 0, "N": 0, "W": 0}
for t, count in counter.items():
d[t] = co... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,065 |
s776264279 | p04019 | u644907318 | 1597799572 | Python | PyPy3 (7.3.0) | py | Accepted | 64 | 62120 | 392 | S = input().strip()
C = {"N":0,"S":0,"E":0,"W":0}
for i in range(len(S)):
C[S[i]] += 1
if C["N"]>0 and C["S"]>0:
if (C["E"]>0 and C["W"]>0) or (C["E"]==0 and C["W"]==0):
print("Yes")
else:
print("No")
elif C["N"]==0 and C["S"]==0:
if (C["E"]>0 and C["W"]>0) or (C["E"]==0 and C["W"]==0):
... | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,066 |
s956343496 | p04019 | u815763296 | 1597799524 | Python | Python (3.8.2) | py | Accepted | 32 | 9248 | 238 | from collections import Counter
S = list(input())
S = Counter(S)
ans = "No"
if len(S) == 4:
ans = "Yes"
elif len(S) == 2:
if "N" in S and "S" in S:
ans = "Yes"
if "W" in S and "E" in S:
ans = "Yes"
print(ans)
| p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,067 |
s268369281 | p04019 | u241159583 | 1597799497 | Python | Python (3.8.2) | py | Accepted | 25 | 9056 | 217 | s = input()
ans = "Yes"
if "N" in s:
if "S" not in s: ans = "No"
if "S" in s:
if "N" not in s: ans = "No"
if "W" in s:
if "E" not in s: ans = "No"
if "E" in s:
if "W" not in s: ans = "No"
print(ans) | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,068 |
s313713629 | p04019 | u086503932 | 1597799338 | Python | PyPy3 (7.3.0) | py | Accepted | 62 | 61772 | 140 | S = input()
if (S.count('S') > 0) == (S.count('N') > 0) and (S.count('E') > 0) == (S.count('W') > 0):
print('Yes')
else:
print('No') | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,069 |
s110275055 | p04019 | u588794534 | 1597799262 | Python | PyPy3 (7.3.0) | py | Accepted | 77 | 61780 | 298 | s=input()
if s.count("N")>0 and s.count("S")==0:
print("No")
exit()
if s.count("S")>0 and s.count("N")==0:
print("No")
exit()
if s.count("W")>0 and s.count("E")==0:
print("No")
exit()
if s.count("E")>0 and s.count("W")==0:
print("No")
exit()
else:
print("Yes") | p04019 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Snuke lives on an infinite two-dimensional plane. He is going on an <var>N</var>-day trip.
At the beginning of Day <var>1</var>, he is at home. His plan is described in a string <var>S</var> of length <... | SENW
| Yes
| 1,200,070 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.