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
s634613771
p04019
u299869545
1471829652
Python
Python (2.7.6)
py
Accepted
25
2568
199
x = raw_input() n = x.count('N') e = x.count('E') w = x.count('W') s = x.count('S') if n > 0:n = 1 if e > 0:e = 1 if w > 0:w = 1 if s > 0:s = 1 if (n == s) and (e == w):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,871
s895489214
p04019
u566924053
1471829308
Python
Python (3.4.3)
py
Accepted
38
3064
199
s = input() nsflag = ("N" in s and "S" in s) or ("S" not in s and "N" not in s) ewflag = ("E" in s and "W" in s) or ("E" not in s and "W" not in s) print("Yes") if nsflag and ewflag 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,872
s188885820
p04019
u860972915
1471829010
Python
Python (3.4.3)
py
Accepted
39
3064
305
s = input() nc = s.count('N') sc = s.count('S') ec = s.count('E') wc = s.count('W') if nc >= 1 and sc >= 1 and ec >= 1 and wc >= 1: print('Yes') elif nc == 0 and sc == 0 and ec >= 1 and wc >= 1: print('Yes') elif ec == 0 and wc == 0 and nc >= 1 and sc >= 1: 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,873
s874858441
p04019
u601018334
1471828896
Python
Python (3.4.3)
py
Accepted
38
3064
281
s = input() N = 0 S = 0 W = 0 E = 0 for i in range(len(s)) : str = s[i] if str == 'N' : N = 1 elif str == 'S': S = 1 elif str == 'W': W = 1 elif str == 'E': E = 1 if (N-S)==0 and (W-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,874
s436672764
p04019
u100054963
1471828880
Python
Python (3.4.3)
py
Accepted
42
3064
250
S = input() N_Flag = True if 'N' in S else False E_Flag = True if 'E' in S else False W_Flag = True if 'W' in S else False S_Flag = True if 'S' in S else False if ((N_Flag is S_Flag) and (E_Flag is W_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,875
s646227162
p04019
u810735437
1471828819
Python
Python (3.4.3)
py
Accepted
39
3064
359
#!/usr/bin/env python3 # -*- coding: utf-8 -*- S = set(input()) if ('S' in S and 'N' not in S) or \ ('N' in S and 'S' not in S) or \ ('E' in S and 'W' not in S) or \ ('W' in S and 'E' not in 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,876
s068472192
p04019
u492932526
1471828674
Python
Python (2.7.6)
py
Accepted
27
2568
279
# coding: UTF-8 s = raw_input() if 'N' in s and 'W' in s and 'S' in s and 'E' in s: print "Yes" elif 'N' in s and not 'W' in s and 'S' in s and not 'E' in s: print "Yes" elif not 'N' in s and 'W' in s and not 'S' 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,877
s275962686
p04019
u813098295
1471828638
Python
Python (2.7.6)
py
Accepted
28
2568
283
ans = 'Yes' S = list(raw_input()) if S.count('N') == 0 and S.count('S') != 0: ans = 'No' elif S.count('W') == 0 and S.count('E') != 0: ans = 'No' elif S.count('S') == 0 and S.count('N') != 0: ans = 'No' elif S.count('E') == 0 and S.count('W') != 0: 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,878
s936139480
p04019
u187430339
1471828618
Python
Python (2.7.6)
py
Accepted
29
2568
376
import sys #sys.stdin = open('a_3.txt', 'r') chars = list(raw_input()) #N, E, S, W directions = [0 for _ in range(4)] for c in chars: if c == 'N': directions[0] = 1 elif c == 'E': directions[1] = 1 elif c == 'S': directions[2] = 1 else: directions[3] = 1 if ((directions[0] == directions[2]) and (direction...
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,879
s813491397
p04019
u124139453
1471828609
Python
Python (2.7.6)
py
Accepted
29
2692
392
import math,sys s = list(raw_input()) if len(s) == 0: print "Yes" sys.exit() if s.count("N") == s.count("S") == 0: if "E" in s and "W" in s: print "Yes" sys.exit() if s.count("E") == s.count("W") == 0: if "N" in s and "S" in s: print "Yes" sys.exit() if "W" in s and "E" i...
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,880
s662316892
p04019
u393971002
1471828587
Python
Python (3.4.3)
py
Accepted
39
3064
279
s = input() str_set = set([i for i in s]) n = len(str_set) if len(str_set) == 4: print("Yes") elif len(str_set) == 2: if( "S" in str_set and "N" in str_set) or ("W" in str_set and "E" in str_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,881
s154281208
p04019
u821262411
1471828447
Python
Python (3.4.3)
py
Accepted
37
3064
195
t=str(input()) n=t.count('N') s=t.count('S') w=t.count('W') e=t.count('E') if n-s !=0 and n*s==0: print('No') exit() if w-e !=0 and w*e==0: 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,882
s533517133
p04019
u357487020
1471828442
Python
Python (2.7.6)
py
Accepted
26
2692
466
s=raw_input() cntn=0 cnts=0 cnte=0 cntw=0 for i in s: if i=="S": cnts+=1 elif i=="E": cnte+=1 elif i=="N": cntn+=1 else: cntw+=1 if cntn>0 and cnts>0 and cntw>0 and cnte>0: print("Yes") elif cntn>0 and cnts>0 : if cntw==0 and cnte==0: print('Yes') 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,883
s114930416
p04019
u786082266
1471828390
Python
Python (2.7.6)
py
Accepted
28
2568
204
a = raw_input() n, w, s, e = -1, -1, -1, -1 for i in a: if i == "S": s = 1 if i == "W": w = 1 if i == "E": e = 1 if i == "N": n = 1 if w * e > 0 and n * s > 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,884
s155928405
p04019
u765237551
1471828326
Python
Python (3.4.3)
py
Accepted
36
3064
239
S = input() def f(a, b, s): if a in s and b in s: return True elif not a in s and not b in s: return True else: return False if f('N', 'S', S) and f('W', 'E', 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,885
s682447276
p04019
u966695411
1471828322
Python
Python (3.4.3)
py
Accepted
38
3064
229
S = set(input()) if 'N' in S and not 'S' in S: print('No') elif 'S' in S and not 'N' in S: print('No') elif 'W' in S and not 'E' in S: print('No') elif 'E' in S and not 'W' 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,886
s351056635
p04019
u107077660
1471828294
Python
Python (3.4.3)
py
Accepted
40
3064
271
s = input() for l in s: if l == "N": if "S" not in s: print("No") break if l == "S": if "N" not in s: print("No") break if l == "E": if "W" not in s: print("No") break if l == "W": if "E" not in s: print("No") break 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,887
s561363276
p04019
u579875569
1471828284
Python
Python (3.4.3)
py
Accepted
36
3064
210
S = input() flag = True s = not (S.find("S") == -1) n = not (S.find("N") == -1) w = not (S.find("W") == -1) e = not (S.find("E") == -1) flag &= not s^n flag &= not w^e print("Yes") if flag 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,888
s661864609
p04019
u945080461
1471828240
Python
Python (2.7.6)
py
Accepted
27
2568
187
s = raw_input().strip() ans = f = 0 for c in 'NS': if s.count(c): f ^= 1 ans |= f f = 0 for c in 'EW': if s.count(c): f ^= 1 ans |= f print "No" if ans 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,889
s560476816
p04019
u341469181
1471828232
Python
Python (3.4.3)
py
Accepted
39
3064
249
def solve(S): if 'N' in S and 'S' not in S: return False if 'S' in S and 'N' not in S: return False if 'E' in S and 'W' not in S: return False if 'W' in S and 'E' not in S: return False return True print('Yes' if solve(input()) 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,890
s333945790
p04019
u233602244
1471828163
Python
Python (3.4.3)
py
Accepted
45
3316
246
from collections import Counter s = input() c = Counter(s) if (c['N'] == 0 and c['S'] > 0) or (c['S'] == 0 and c['N'] > 0): print('No') elif (c['W'] == 0 and c['E'] > 0) or (c['E'] == 0 and c['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,891
s940425170
p04019
u657357805
1471828138
Python
Python (3.4.3)
py
Accepted
39
3064
307
S=list(input().strip()) n=False e=False s=False w=False for i in S: if(i=="N"): n=True elif(i=="E"): e=True elif(i=="S"): s=True elif(i=="W"): w=True if(n and e and s and w): break if(n == s) and (e == w): 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,892
s050855327
p04019
u123756661
1471828109
Python
Python (2.7.6)
py
Accepted
25
2568
145
s=list(raw_input()) s=set(s) print 'Yes' if len(s)==4 or (len(s)==2 and 'S' in s and 'N' in s) or (len(s)==2 and 'W' in s and 'E' in 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,893
s955805810
p04019
u620084012
1471828064
Python
Python (3.4.3)
py
Accepted
42
3064
148
S = str(input()) T = set([x for x in S]) if T == {'S', 'N'} or T == {'W', 'E'} or T == {'S', 'N', '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,894
s419516153
p04019
u725662235
1471828046
Python
Python (2.7.6)
py
Accepted
28
2568
303
s = raw_input() if s.count('S') > 0 and s.count('N') == 0: print "No" exit() if s.count('N') > 0 and s.count('S') == 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() 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,895
s030368952
p04019
u024612773
1471828010
Python
Python (3.4.3)
py
Accepted
39
3064
95
s=input() print('Yes' if ((('N' in s) == ('S' in s)) and (('W' in s) == ('E' in 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,896
s308531902
p04019
u098968285
1471828003
Python
Python (3.4.3)
py
Accepted
39
3064
234
s = input() dp = [False]*4 for c in s: if c == "N": dp[0] = True elif c == "S": dp[1] = True elif c == "E": dp[2] = True elif c == "W": dp[3] = True if dp[0] == dp[1] and dp[2] == dp[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,897
s868098718
p04019
u776189585
1471828000
Python
Python (2.7.6)
py
Accepted
27
2572
179
s = raw_input() if ('N' in s and 'S' not in s) or ('W' not in s and 'E' in s) or ('N' not in s and 'S' in s) or ('W' in s and 'E' 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,898
s375046195
p04019
u558431380
1471827997
Python
Python (3.4.3)
py
Accepted
44
3064
317
directions=input() sens=["N","S","W","E"] compteur=[0]*4 for direction in directions: compteur[sens.index(direction)]+=1 if (compteur[0]>0 and compteur[1]==0) or (compteur[1]>0 and compteur[0]==0) or (compteur[2]>0 and compteur[3]==0) or (compteur[3]>0 and compteur[2]==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,899
s443827567
p04019
u352021237
1471827993
Python
PyPy2 (5.6.0)
py
Accepted
57
8816
244
y=raw_input() f=0 if y.count('N')>0: if y.count('S')==0: f=1 if y.count('S')>0: if y.count('N')==0: f=1 if y.count('E')>0: if y.count('W')==0: f=1 if y.count('W')>0: if y.count('E')==0: f=1 if f: 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,900
s875987276
p04019
u187945597
1471827983
Python
Python (2.7.6)
py
Accepted
27
2572
315
s = raw_input() up,down,left,right = False,False,False,False for i in xrange(len(s)) : if s[i] == 'N' : up = True elif s[i] == 'S' : down = True elif s[i] == 'E' : left = True else : right = True if (up!=down) or (left!=right) : 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,901
s529379906
p04019
u758661720
1471827971
Python
Python (2.7.6)
py
Accepted
31
2692
386
s = raw_input() count = {} count['N'] = 0 count['W'] = 0 count['E'] = 0 count['S'] = 0 for c in s: count.setdefault(c,0) count[c] += 1 ok = True if(count['N']==0 and count['S']!=0): ok = False if(count['N']!=0 and count['S']==0): ok = False if(count['W']==0 and count['E']!=0): ok = False if(count['W']!=0 and ...
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,902
s125669814
p04019
u010733367
1471827910
Python
Python (3.4.3)
py
Accepted
40
3064
485
S = input() is_N = S.find("N") != -1 is_W = S.find("W") != -1 is_S = S.find("S") != -1 is_E = S.find("E") != -1 if is_N: if is_S: flg = True else: flg = False else: if is_S: flg = False else: flg = True if not flg: print("No") exit() if is_W: if is_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,903
s133987039
p04019
u562036212
1471827893
Python
Python (2.7.6)
py
Accepted
79
4900
881
# -*- coding: utf-8 -*- import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys def s(): return raw_input().strip() def n(): return int(raw_input()) def d(): return float(raw_input()) def ls(): return raw_input().strip().split() def ln(): return map(int, raw_input().strip().sp...
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,904
s719005575
p04019
u941268675
1471827880
Python
Python (2.7.6)
py
Accepted
27
2572
245
S = raw_input() ans = True if "N" in S: ans = ("S" in S) and ans if "S" in S: ans = ("N" in S) and ans if "E" in S: ans = ("W" in S) and ans if "W" in S: ans = ("E" in S) and ans print "Yes" if ans 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,905
s639023645
p04019
u518732500
1471827861
Python
Python (3.4.3)
py
Accepted
41
3064
291
def solve(): s = input() v = 0 h = 0 if 'N' in s: v -= 1 if 'S' in s: v += 1 if 'W' in s: h -= 1 if 'E' in s: h += 1 print('Yes' if v == 0 and h == 0 else 'No') def main(): solve() 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,906
s509923247
p04019
u374099594
1471827844
Python
Python (2.7.6)
py
Accepted
26
2572
203
S = raw_input() if ((S.find("N")>=0 and S.find("S")>=0 or S.find("N")<0 and S.find("S")<0) and (S.find("E")>=0 and S.find("W")>=0 or S.find("E")<0 and S.find("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,907
s739532531
p04019
u145496715
1471827841
Python
PyPy2 (5.6.0)
py
Accepted
60
8816
254
home = True s = raw_input().strip() if 'N' in s and 'S' not in s: home = False if 'S' in s and 'N' not in s: home = False if 'W' in s and 'E' not in s: home = False if 'E' in s and 'W' not in s: home = False print('Yes' if home 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,908
s247053520
p04019
u499893886
1471827794
Python
Python (3.4.3)
py
Accepted
70
3188
98
S=input() n,w,e,s='N' in S, 'W' in S, 'E' in S, 'S' in S print('Yes' if (n==s and e==w) 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,909
s447724129
p04020
u044220565
1600475976
Python
Python (3.8.2)
py
Accepted
57
18296
1,124
# coding: utf-8 import sys #from operator import itemgetter sysread = sys.stdin.buffer.readline read = sys.stdin.buffer.read #from heapq import heappop, heappush #from collections import defaultdict sys.setrecursionlimit(10**7) #import math #from itertools import product, accumulate, combinations, product #import bisec...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,910
s308781227
p04020
u119148115
1600134904
Python
PyPy3 (7.3.0)
py
Accepted
99
77184
290
import sys def I(): return int(sys.stdin.readline().rstrip()) N = I() A = [I() for _ in range(N)] ans = 0 for i in range(N): a = A[i] ans += a//2 A[i] -= 2*(a//2) if A[i] == 1 and i < N-1 and A[i+1] >= 1: ans += 1 A[i] = 0 A[i+1] -= 1 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,911
s554504083
p04020
u119148115
1600134433
Python
PyPy3 (7.3.0)
py
Accepted
99
77848
731
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def S(): return s...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,912
s191126954
p04020
u054514819
1600133744
Python
PyPy3 (7.3.0)
py
Accepted
92
77464
409
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N = int(input()) Xs = [int(input()) for _ in range(N)] last = 0 ans = 0 for i in range(1, N+1): cnt = Xs[i-1] if cnt<=last: ans += cnt last = 0 else: ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,913
s190172013
p04020
u888092736
1599843618
Python
Python (3.8.2)
py
Accepted
79
20148
166
N, *A = map(int, open(0).read().split()) r = 0 ans = 0 for a in A: if a == 0: r = 0 continue q, r = divmod(a + r, 2) ans += q print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,914
s790027265
p04020
u397496203
1599275009
Python
PyPy3 (7.3.0)
py
Accepted
94
73776
578
# https://atcoder.jp/contests/agc003/tasks/agc003_b 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(): n = input_int() tmp = 0 ans = 0...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,915
s926405133
p04020
u098012509
1598315969
Python
Python (3.8.2)
py
Accepted
83
12992
470
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 amari = 0 for a in A: if amari == 0: amari = a % 2 ans += a // 2 else: ans += min(amari, a) ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,916
s881991599
p04020
u193264896
1597496274
Python
Python (3.8.2)
py
Accepted
79
13028
542
import sys read = sys.stdin.read readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N = int(readline()) A = list(int(readline()) for _ in range(N)) ans = 0 for i in range(N): if i==N-1: ans += A[i] // 2 els...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,917
s776736290
p04020
u857759499
1597457726
Python
Python (3.8.2)
py
Accepted
98
20060
208
n,*a = map(int,open(0).read().split()) ans = a[0]//2 a[0] %= 2 for i in range(n-1): if a[i] == 1 and a[i+1] != 0: ans += 1 a[i+1] -= 1 if a[i+1] >1: ans += a[i+1]//2 a[i+1] %= 2 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,918
s514281776
p04020
u827202523
1596800567
Python
PyPy3 (7.3.0)
py
Accepted
100
79764
3,399
import sys import math import copy import heapq from functools import cmp_to_key from bisect import bisect_left, bisect_right from collections import defaultdict, deque, Counter sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() getN = lambda: int(input()) getList ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,919
s291128620
p04020
u093041722
1596067652
Python
Python (3.8.2)
py
Accepted
66
20036
179
N,*A = map(int, open(0).read().split()) ans = 0 cum = 0 for i in range(N): if A[i] > 0: cum += A[i] else: ans += cum // 2 cum = 0 print(ans+cum//2)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,920
s691631025
p04020
u934442292
1595709863
Python
Python (3.8.2)
py
Accepted
84
12620
479
import sys input = sys.stdin.readline def main(): N = int(input()) A = [0] * N for i in range(N): A[i] = int(input()) if N == 1: ans = A[0] // 2 else: ans = 0 for i in range(N - 1): if A[i + 1] == 0: ans += A[i] // 2 else: ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,921
s560859106
p04020
u747703115
1595702779
Python
Python (3.8.2)
py
Accepted
72
9148
210
import sys n = int(sys.stdin.readline()) ans = 0 t = 0 for i in range(n): a = int(sys.stdin.readline()) if a==0: ans += t//2 t = 0 else: t += a if t>0: ans += t//2 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,922
s058634375
p04020
u062691227
1595641492
Python
Python (3.8.2)
py
Accepted
87
19964
176
n,*aa = map(int, open(0).read().split()) ans = 0 for i in range(n): ans += aa[i]//2 if aa[i]%2 and i+1<n and aa[i+1]: ans += 1 aa[i+1] -= 1 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,923
s950174965
p04020
u934442292
1595623598
Python
Python (3.8.2)
py
Accepted
82
12756
501
import sys input = sys.stdin.readline def main(): N = int(input()) A = [0] * N for i in range(N): A[i] = int(input()) if N == 1: ans = A[0] // 2 else: ans = 0 for i in range(N - 1): if A[i + 1] == 0: ans += A[i] // 2 else: ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,924
s826254236
p04020
u285891772
1595037860
Python
Python (3.8.2)
py
Accepted
93
14472
1,128
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,925
s314934982
p04020
u163783894
1594348793
Python
Python (3.8.2)
py
Accepted
99
18540
1,291
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline in_n = lambda: int(readline()) in_nn = lambda: map(int, readline().split()) in_nl = lambda: list(map(int, readline().split())) in_na = lambda: map(int, read().split()) in_s = lambda: readline().rstrip().decode('utf-8') def main(): N =...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,926
s869446271
p04020
u888092736
1594133568
Python
Python (3.8.2)
py
Accepted
88
20112
211
N, *A = map(int, open(0).read().split()) ans = 0 for i in range(N): q, r = divmod(A[i], 2) ans += q if r == 0 or i == N - 1: continue elif A[i + 1] != 0: A[i + 1] += 1 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,927
s575175446
p04020
u535803878
1593982543
Python
PyPy3 (7.3.0)
py
Accepted
97
76168
379
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n = int(input()) a = [None]*n for i in range(n): a[i] = int(input()) ans = 0 for i in range(n): num = a[i] if num%2==1: if i+1<n and a[i+1]>0: an...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,928
s895796853
p04020
u707498674
1593749689
Python
Python (3.8.2)
py
Accepted
91
13060
384
import sys def input():return sys.stdin.readline().strip() def main(): N = int(input()) A = [int(input()) for _ in range(N)] ans = 0 for i in range(N-1): if A[i] >= 2: ans += A[i]//2 if A[i]%2 == 1 and A[i+1] >= 1: ans += 1 A[i+1] -= 1 ans +...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,929
s262303066
p04020
u086503932
1593487899
Python
Python (3.8.2)
py
Accepted
69
13252
449
#!/usr/bin/env python3 from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right def main(): N, *A = map(int, open(0)) ans = 0 i = 0 prev = 0 while i < N: if A[i] == 0: prev = 0 else: ans += (A[i]+prev)//2 ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,930
s039510372
p04020
u557168336
1593295326
Python
Python (3.8.2)
py
Accepted
81
13844
531
import sys input = sys.stdin.readline # from collections import deque def linput(_t=int, cnv=list): return cnv(map(_t, input().split())) def gcd(n,m): while m: n,m = m, n%m return n def lcm(n,m): return n*m//gcd(n,m) def main(): N = int(input()) vA = [int(input()) for _ in [0,]*N] res = 0 ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,931
s153719767
p04020
u102461423
1592593636
Python
Python (3.8.2)
py
Accepted
92
18408
324
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, *A = map(int, read().split()) A = [0] + A answer = 0 for i in range(1, N + 1): if A[i - 1] and A[i]: answer += 1 A[i] -= 1 n, A[i] = divmod(A[i], 2) answer += n print(ans...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,932
s513470216
p04020
u475675023
1592557452
Python
Python (3.8.2)
py
Accepted
98
20064
242
n,*a=map(int,open(0).read().split()) ans=0 if n==1: print(a[0]//2) exit() for i in range(n-1): if (a[i]+a[i+1])%2==0: ans+=(a[i]+a[i+1])//2 a[i+1]=0 else: ans+=(a[i]+a[i+1])//2 a[i+1]=(0 if a[i+1]==0 else 1) print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,933
s529856171
p04020
u373047809
1588884764
Python
Python (3.4.3)
py
Accepted
67
7084
111
from itertools import* _, *a = map(int, open(0)) print(sum(sum(l)//2 for _, l in groupby(a, key=lambda x:x>0)))
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,934
s473205365
p04020
u476604182
1587930321
Python
Python (3.4.3)
py
Accepted
57
14092
153
N, *A = map(int, open(0).read().split()) ls = [] s = 0 ans = 0 for c in A: if c==0: ans += s//2 s = 0 else: s += c ans += s//2 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,935
s499606228
p04020
u340781749
1587283469
Python
Python (3.4.3)
py
Accepted
94
12496
235
import sys n, *aaa = map(int, sys.stdin.buffer.read().split()) ans = 0 for i in range(n - 1): d, m = divmod(aaa[i], 2) ans += d if m and aaa[i + 1]: aaa[i + 1] -= 1 ans += 1 ans += aaa[-1] // 2 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,936
s493621990
p04020
u179169725
1586569370
Python
Python (3.4.3)
py
Accepted
81
14092
627
# https://atcoder.jp/contests/agc003/tasks/agc003_b enu = enumerate ra = range N, *A = map(int, open(0).read().split()) ans = 0 # 先に作れるのは作ったのほうが本当によいのか?←だめ ''' 反例 1...1 2...2 3...1のとき、2同士で先にペアを作る前に上と下に配ったほうがいい ''' # 1から順にgreedyでは?反例は?なさそう # ただしカードがないときは作れない(stockが強制的に0になる)ので注意 stock = 0 # or 1 for a in A: if a...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,937
s472330273
p04020
u560867850
1586461478
Python
Python (3.4.3)
py
Accepted
66
7068
279
import sys input = sys.stdin.readline from math import floor def main(): n = int(input()) A = [int(input()) for _ in range(n)] x = 0 for a in A: if a == 0: yield x // 2 x = 0 x += a yield x // 2 print(sum(main()))
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,938
s927920671
p04020
u242031676
1582463247
Python
Python (3.4.3)
py
Accepted
84
14092
160
n, *a = map(int, open(0).read().split()) ans = prev = 0 for i in a: tmp, prev = divmod(i+prev, 2) ans += tmp if i==0: prev=0 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,939
s770044666
p04020
u987164499
1582272997
Python
Python (3.4.3)
py
Accepted
84
7072
264
from sys import stdin n = int(stdin.readline().rstrip()) li = [int(stdin.readline().rstrip()) for _ in range(n)] count = 0 point = 0 for i in li: if i == 0: point += count//2 count = 0 else: count += i point += count//2 print(point)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,940
s978839523
p04020
u987164499
1582272869
Python
Python (3.4.3)
py
Accepted
85
7088
294
from sys import stdin from itertools import groupby n = int(stdin.readline().rstrip()) li = [int(stdin.readline().rstrip()) for _ in range(n)] count = 0 point = 0 for i in li: if i == 0: point += count//2 count = 0 else: count += i point += count//2 print(point)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,941
s559989826
p04020
u648212584
1578020691
Python
Python (3.4.3)
py
Accepted
87
3928
518
import sys input = sys.stdin.buffer.readline def main(): N = int(input()) ans = 0 L = [0] for i in range(N): num = int(input()) if L[-1] == 0: ans += (num//2) L.append(num%2) else: if num == 0: L.append(num) con...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,942
s224839991
p04020
u102461423
1577455931
Python
Python (3.4.3)
py
Accepted
88
12512
332
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,*A = map(int,read().split()) rest = 0 answer = 0 for x in A: if not x: rest = 0 continue if rest: x -= 1 answer += 1 q,rest = divmod(x,2) answer += q p...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,943
s848957681
p04020
u905582793
1577034917
Python
Python (3.4.3)
py
Accepted
81
7072
217
import sys input = sys.stdin.readline n=int(input()) a = [int(input()) for i in range(n)] a.append(0) ans = 0 tmp = 0 for i in range(n+1): if a[i]!=0: tmp += a[i] else: ans += tmp//2 tmp = 0 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,944
s085428170
p04020
u927534107
1574961412
Python
Python (3.4.3)
py
Accepted
97
7072
183
import sys input = sys.stdin.readline n=int(input()) l=[int(input()) for _ in range(n)] ans=0 re=0 for i in l: if i==0: re=0 ans+=(i+re)//2 re=(i+re)%2 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,945
s965739929
p04020
u945181840
1574904837
Python
Python (3.4.3)
py
Accepted
89
14092
235
import sys read = sys.stdin.read N, *A = map(int, read().split()) answer = 0 for i in range(N - 1): if A[i] % 2 == 1: if A[i + 1] != 0: A[i + 1] += 1 answer += A[i] // 2 answer += A[-1] // 2 print(answer)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,946
s862270250
p04020
u945181840
1574904742
Python
Python (3.4.3)
py
Accepted
76
14092
224
import sys read = sys.stdin.read N, *A = map(int, read().split()) answer = 0 for i in range(N - 1): if A[i] % 2 == 1: if A[i + 1] != 0: A[i + 1] += 1 answer = sum([i // 2 for i in A]) print(answer)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,947
s904652193
p04020
u076917070
1572648233
Python
Python (3.4.3)
py
Accepted
73
3060
319
import sys input = sys.stdin.readline # 解説AC def main(): N = int(input()) ans = 0 x = 0 for i in range(N): a = int(input()) if a == 0: ans += x//2 x = 0 else: x += a ans += x//2 print(ans) if __name__ == '__main__': main()
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,948
s784826215
p04020
u076917070
1572647860
Python
Python (3.4.3)
py
Accepted
91
3060
450
import sys input = sys.stdin.readline def main(): N = int(input()) carry = 0 ans = 0 for i in range(N): x = int(input()) if carry and x > 0: ans += 1 # carry を優先して処理 d, m = divmod(x - 1, 2) ans += d carry = m else: d,...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,949
s223871095
p04020
u370331385
1570384310
Python
Python (3.4.3)
py
Accepted
86
3064
535
import sys input=sys.stdin.readline N = int(input()) #(方針)同じ数でペアを作りまくる → 残りで隣の数とペアを作れるか #→ この方針はダメ #(ダメな例) #1 3 #2 4 #3 5 #上の方針) ans = 1+2+2 = 5 #正答) ans = 6 ((1,1)×1,(1,2)×1,(2,2)×1,(2,3)×1,(3,3)×2) #(方針)枚数0が来たら (それまでのカードの枚数の和//2)ペア 作れる ans = 0 sum_a = 0 for i in range(N): a = int(input()) sum_a += a if(a == ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,950
s321280916
p04020
u366959492
1570289322
Python
Python (3.4.3)
py
Accepted
85
7072
199
import sys input=sys.stdin.readline n=int(input()) a=[int(input()) for _ in range(n)] ans=0 s=0 for i in range(n): s+=a[i] if a[i]==0: ans+=(s//2) s=0 ans+=(s//2) print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,951
s412346621
p04020
u787456042
1570090725
Python
Python (3.4.3)
py
Accepted
79
7072
75
N,*A=map(int,open(0));p=f=0 for a in A:p+=(a+f)//2;f=(a+f)%2&(a>0) print(p)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,952
s730471833
p04020
u787456042
1570090599
Python
Python (3.4.3)
py
Accepted
90
7072
80
N,*A=map(int,open(0));p=f=0 for a in A:d,m=divmod(a+f,2);p+=d;f=m&(a>0) print(p)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,953
s112859245
p04020
u077291787
1569148696
Python
Python (3.4.3)
py
Accepted
46
14092
353
# AGC003B - Simplified mahjong def main(): # split in subsequences when 0 appears -> sum up cur // 2 N, *A = map(int, open(0).read().split()) A.append(0) ans, cur = 0, 0 for i in A: if i: cur += i else: ans += cur // 2 cur = 0 print(ans) if _...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,954
s481132139
p04020
u480138356
1568012551
Python
Python (3.4.3)
py
Accepted
99
7072
326
import sys input = sys.stdin.readline def main(): N = int(input()) a = [int(input()) for i in range(N)] ans = a[0] // 2 a[0] %= 2 for i in range(1, N): if a[i] > 0: a[i] += a[i-1] ans += a[i] // 2 a[i] %= 2 print(ans) if __name__ == "__main__": ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,955
s382763751
p04020
u606045429
1567163084
Python
Python (3.4.3)
py
Accepted
83
14092
175
N, *A = map(int, open(0).read().split()) ans = 0 pre = 0 for a in A: if a == 0: pre = 0 else: q, pre = divmod(a + pre, 2) ans += q print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,956
s648607888
p04020
u077291787
1566813833
Python
Python (3.4.3)
py
Accepted
58
14252
410
# AGC003B - Simplified mahjong import sys input = sys.stdin.readline def main(): # split in subsequences when 0 appears -> sum up cur // 2 N = int(input()) A = list(map(int, [input() for _ in range(N)])) + [0] ans, cur = 0, 0 for i in A: if i: cur += i else: ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,957
s354431622
p04020
u077291787
1566813392
Python
Python (3.4.3)
py
Accepted
83
14240
429
# AGC003B - Simplified mahjong import sys input = sys.stdin.readline def main(): N = int(input()) A = list(map(int, [input() for _ in range(N)])) + [0] ans = 0 for i in range(N): # make pairs greedily ans += A[i] // 2 # pairs with same cards if A[i] % 2 and A[i + 1]: # pairs with a n...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,958
s952161741
p04020
u077291787
1566813166
Python
Python (3.4.3)
py
Accepted
83
14240
494
# AGC003B - Simplified mahjong import sys input = sys.stdin.readline def main(): N = int(input()) A = list(map(int, [input() for _ in range(N)])) ans = 0 for i in range(N - 1): # make pairs greedily ans += A[i] // 2 # pairs with same cards if A[i] % 2 and A[i + 1]: # pairs with a nei...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,959
s754366607
p04020
u670180528
1566420812
Python
Python (3.4.3)
py
Accepted
56
14196
139
n,*A = map(int,open(0).read().split()) A += [0] psum = ans = 0 for a in A: if a: psum += a else: ans += psum//2 psum = 0 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,960
s264231268
p04020
u392319141
1566412638
Python
Python (3.4.3)
py
Accepted
68
8180
475
import sys import heapq from operator import itemgetter from collections import deque, defaultdict from bisect import bisect_left, bisect_right input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def sol(): N = int(input()) A = [int(input()) for _ in range(N)] + [0] partialSum = 0 ans = 0 fo...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,961
s810715387
p04020
u102461423
1565759580
Python
Python (3.4.3)
py
Accepted
80
7840
293
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) N = int(input()) A = [int(input()) for _ in range(N)] + [0] # 連結成分ごとに、最大1枚残りでできる answer = 0 x = 0 for a in A: if a == 0: answer += x//2 x = 0 x += a print(answer)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,962
s107006666
p04020
u631277801
1562154960
Python
Python (3.4.3)
py
Accepted
99
7072
583
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x) - 1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,963
s015609533
p04020
u375616706
1558033008
Python
Python (3.4.3)
py
Accepted
88
7200
313
# -*- coding: utf-8 -*- # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(input()) L = [int(input()) for _ in range(N)] ans = 0 prev = 0 for a in L: if a == 0: prev = 0 continue a += prev ans += a//2 prev = a % 2 print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,964
s699370212
p04020
u367130284
1555412525
Python
Python (3.4.3)
py
Accepted
90
14092
198
n,*a=map(int,open(0).read().split()) ans=0 for i in range(n-1): ans+=a[i]//2 if a[i]%2==1 and a[i+1]>0: ans+=1 a[i+1]-=1 #print(ans) ans+=a[n-1]//2 #print(a) print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,965
s966731452
p04020
u316386814
1553377833
Python
Python (3.4.3)
py
Accepted
90
7428
693
import sys sys.setrecursionlimit(10**7) INF = 10 ** 18 MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() de...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,966
s386399785
p04020
u745087332
1551605860
Python
Python (3.4.3)
py
Accepted
93
7072
624
# coding:utf-8 import sys INF = float('inf') MOD = 10 ** 9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def II():...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,967
s020970319
p04020
u375616706
1550111264
Python
Python (3.4.3)
py
Accepted
75
7072
286
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline N = int(input()) A = [int(input()) for _ in range(N)] A.append(0) ans = 0 tmp = 0 for a in A: if a == 0: ans += tmp//2 tmp = 0 else: tmp += a print(ans)
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,968
s548651805
p04020
u089230684
1502202242
Python
Python (3.4.3)
py
Accepted
85
3060
377
from sys import stdin def main(): nums = int(stdin.readline()) l = [] actual = int(stdin.readline()) total = 0 for x in range(nums-1): total += actual//2 temp = int(stdin.readline()) if temp != 0: actual = actual%2 + temp else: actual = temp ...
p04020
<span class="lang-en"> <p>Score : <var>400</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke has a large collection of cards. Each card has an integer between <var>1</var> and <var>N</var>, inclusive, written on it. He has <var>A_i</var> cards with an integer <var>i</var>.</p> <p>Two card...
4 4 0 3 2
4
1,200,969
s178259595
p04021
u477977638
1597462803
Python
Python (3.8.2)
py
Accepted
94
19600
738
import sys input = sys.stdin.buffer.readline #sys.setrecursionlimit(10**9) #from functools import lru_cache def RD(): return input().rstrip().decode() def II(): return int(input()) def FI(): return int(input()) def MI(): return map(int,input().split()) def MF(): return map(float,input().split()) def LI(): return list...
p04021
<span class="lang-en"> <p>Score : <var>600</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Snuke got an integer sequence of length <var>N</var> from his mother, as a birthday present. The <var>i</var>-th <var>(1 ≦ i ≦ N)</var> element of the sequence is <var>a_i</var>. The elements are pairwi...
4 2 4 3 1
1
1,200,970