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
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s616513109
p03639
u524922893
1586109662
Python
Python (3.4.3)
py
Runtime Error
17
3064
242
n=int(input()) a=list(map(int,input().split())) b=0 c=0 for i in range(n): if a[i]%2==0: if a[i]%4==0: c+=1 else: b+=1 if b==0: print("Yes") if n<=3*c else print("No") else: print("Yes") if n<=3c+b-1 else print("No")
s745814547
p03639
u166340293
1585429978
Python
Python (3.4.3)
py
Runtime Error
18
2940
199
N=int(input()) a=list(map(int,input().split())) odd=0 four=0 for i in range(N): if a[i]%4==0: four+=1 elif a[i]%2!=0: odd+=1 if four>=odd or four+odd=N: print("Yes") else: print("No")
s010997914
p03639
u718096172
1584812229
Python
Python (3.4.3)
py
Runtime Error
18
3064
309
N = int(input()) aList = [int(i) for i in input().split()] d = {1: 0, 2: 0, 4: 0} for a in aList: if a % 2 == 0: d[2] += 1 elif a % 4 == 4: d[4] += 1 else: d[1] += 1 ans === "No" if d[1] <= d[4]: ans = "Yes" elif d[1] - d[4] == 1: if d[2] == 0: ans = "Yes" print(ans)
s246051108
p03639
u667024514
1584274854
Python
Python (3.4.3)
py
Runtime Error
18
3064
339
h,w=map(int,input().split()) n=int(input()) lis=list(map(int,input().split())) ans=[] cnt=0 s="" hh=0 for i in range(n): for j in range(lis[i]): if hh==0: s=s+str(i+1)+" " else: s=str(i+1)+" "+s cnt+=1 if cnt==w: ans.append(s) s="" cnt=0 hh=(hh+1)%2 for i in range(h...
s268421323
p03639
u173329233
1582771487
Python
Python (3.4.3)
py
Runtime Error
69
15020
287
n = int(input()) l = list(map(int, input().split())) k = [] k_2 = [] k_4 = [] for i in l: if i % 4 == 0: k_4.append(i) elif i % 2 == 0: k_2.append(i) else: k.append(i) if len(k_4) >= len(k)-1 and k_2%2 == 0: print('Yes') else: print('No')
s780463064
p03639
u278670845
1579024141
Python
Python (3.4.3)
py
Runtime Error
43
14252
322
n=int(input()) a=list(map(int,input().split())) a1=0 a2=0 a3=0 for i in a: if a%4==0: a1+=1 elif a%4==2: a2+=1 else: a3+=1 if a3==0: print("Yes") else: if a2==0: if a1>=a3-1: print("Yes") else: print("No") else: if a1>=a3: print("Yes") else: print("No...
s476891719
p03639
u244416763
1576544598
Python
Python (3.4.3)
py
Runtime Error
42
14484
649
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) s,p,j = 0,0,0 c = [] for i in range((31-n)+1): c.append(a[s]) #昼夜昼夜の順にまとめちゃう c.append(b[s]) #まとめた配列をc[]とする s += 1 i += 1 while (j < 2*(31-(n-1))-2): #ここ自分でもよくわかんない if (c[j] == 0 and c[j+1] == 0 and c[j+2] == 0 ): #3つ連続で予定...
s416334517
p03639
u186206732
1576295126
Python
Python (3.4.3)
py
Runtime Error
17
2940
341
n=int(input()) l=list(map(int,input().split())) c2=0 c4=0 for i in l: if i%4 == 0: c4+=1 if i%2 == 0: c2+=1 c2 = c2-c4 if c2=1: if n - (2*c4+2) <=0: print('Yes') else: print('No') elif c4=0: if n==c2: print('Yes') else: print('No') else: if n - (2*c4+2 + c2) <= 0: print('Yes') else: ...
s841981262
p03639
u896820793
1573089661
Python
Python (2.7.6)
py
Runtime Error
10
2568
219
#include<cstdio> int main(){int n,a = 0,b = 0; scanf("%d",&n); for(int i=1;i<=n;i++){ int c; scanf("%d",&c); if(!(c % 4)) a++; else if(!(c % 2)) b++;} if(b > 1) n -= b; if(a * 2 >= n) printf("Yes"); else printf("No");}
s743829287
p03639
u066455063
1571708910
Python
Python (3.4.3)
py
Runtime Error
2103
14252
364
N = int(input()) a = list(map(int, input().split())) count = 0 two_count = 0 for i in a: if i % 4 == 0: count += 1 if a[i] != 2: if a[i] * 2 % 4 == 0: two_count += 1 num = a.count(2) while num % 2 == 0: num //= 2 count += 1 if num > 0: if two_count >= 1: count...
s843053313
p03639
u311636831
1569442420
Python
Python (3.4.3)
py
Runtime Error
18
3064
375
a = list(map(int, input().split())) for i in range(N): A += [i + 1] * a[i] L = [[0 for i in range(W)] for j in range(H)] for i in range(H * W): if int((i // W)) % 2 == 0: L[int((i // W))][i % W] = A[i] else: L[int((i // W))][-1 - i % W] = A[i] for i in range(H): L[i] = list(map(str, ...
s909138303
p03639
u887207211
1565985545
Python
Python (3.4.3)
py
Runtime Error
24
5028
516
N = int(input()) two_ad = 0 four_ad = 0 other = 0 for _ in range(N): a = int(input()) if a % 4 == 0 and a % 2 == 0: four_ad += 1 elif a % 4 == 0: four_ad += 1 elif a % 2 == 0: two_ad += 1 else: other += 1 if not two_ad and not four_ad: ans = "No" elif not two_ad: if other == four_ad + 1 ...
s502774439
p03639
u631277801
1560945097
Python
Python (3.4.3)
py
Runtime Error
18
3064
639
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().rstri...
s147205650
p03639
u859897687
1555999423
Python
Python (3.4.3)
py
Runtime Error
17
2940
196
n=int(input()) m=list(map(int,input().split())) for i in range(n): a=0 for m[i]>1: m[i]//=2 a+=1 if a>2: a=2 m[i]=a if m.count(2)>m.count(1): print("Yes") else: print("No")
s687949621
p03639
u516272298
1555607315
Python
Python (3.4.3)
py
Runtime Error
64
15020
263
n = int(input()) a = list(map(int,input().split())) t1 = 0 t2 = 0 t4 = 0 for i in a: if i % 4 == 0: t4 += 1 elif i % 2 == 0: t2 += 1 else: t1 += 1 if (t4 >= t1) or (t2 == 0 and t4+1 == t): print("Yes") else: print("No")
s521693183
p03639
u798129018
1554765333
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38768
270
H,W = map(int,input().split()) N = int(input()) a = list(map(int,input().split())) c = [[0]*(W) for i in range(H)] l = [] for m,color in enumerate(a,1): l += [color]*m for i in range(H): k = l[:W] l = l[W:] if i%2 != 0: k.reverse() print(*k)
s337700771
p03639
u967835038
1554183758
Python
Python (3.4.3)
py
Runtime Error
17
2940
336
from math import ceil n=int(input()) ans4=0 ans2=0 ans0=0 a=list(map(int,input().split())) for i in range(n): if a[i]%4==0: ans4+=1 elif a[i]%2==0: ans2+=1 else: ans0+=1 if ans2>0: if ans0<=ans4: print('Yes') else: print('No') else: if ceil((ans0+ans4)/2)>=:ans0 print('Yes') else: ...
s907443249
p03639
u967835038
1554181068
Python
Python (3.4.3)
py
Runtime Error
27
11096
199
n=int(input()) ans4=0 ans2=0 a=input().split() for i in range(n): if a[i]%4==0: ans4+=1 elif a[i]%2==0: ans2+=1 else: pass if (n-ans2)//2+1<=ans4: print('Yes') else: print('No')
s182790772
p03639
u054106284
1550015388
Python
Python (3.4.3)
py
Runtime Error
17
3064
378
H, W = (int(i) for i in input().split()) N = int(input()) A = [int(i) for i in input().split()] C = [] for i in range(N): for j in range(A[i]): C.append(i+1) ans = [[0]*W for i in range(H)] for i in range(H*W): y = i // W if y%2==0: x = i%W else: x = W-1-i%W ans[x][y] = C[i] for i in range(H): a...
s570874696
p03639
u054106284
1549977934
Python
Python (3.4.3)
py
Runtime Error
74
14252
269
N = int(input()) A = [int(i) for i in input().split()] c4=0 c2=0 for i in range(N): if A[i]%4==0: c4+=1 elif A[i]%2==0: c2+=1 if c4: a = c4*2+1 else: a = 0 if c2>1: b = c2b if a: a -= 1 else: b = 0 if a+b>=N: print("Yes") else: print("No")
s351684785
p03639
u682985065
1522732520
Python
Python (3.4.3)
py
Runtime Error
72
15020
271
n = int(input()) a = list(map(int, input().split())) cnt = 0 for ai in a: if ai % 4 == 0: cnt += 1 else: if ai % 2 == 0: cnt += 0.5 n -= 0.5 if math.floor(cnt) >= (math.ceil(n) - 2): print('yes') else: print('no')
s764451190
p03639
u817328209
1519707019
Python
Python (3.4.3)
py
Runtime Error
17
2940
329
n = int(input()) a = list(map(int, input().split())) odds = 0 evens2 = 0 evens4 = for ai in a : if ai % 4 == 0 : evens4 += 1 elif ai % 2 == 0 : evens2 += 1 else : odds += 1 if evens4 >= odds : print('Yes') elif odds - evens4 == 1 and evens2 == 0 : print('Yes') else : pr...
s354376888
p03639
u817328209
1519706976
Python
Python (3.4.3)
py
Runtime Error
17
2940
329
n = int(input()) a = list(map(int, input().split())) odds = 0 evens2 = 0 evens4 = for ai in a : if ai % 4 == 0 : evens4 += 1 elif ai % 2 == 0 : evens2 += 1 else : odds += 1 if evens4 >= odds : print('Yes') elif odds - evens4 == 1 and evens2 == 0 : print('Yes') else : pr...
s384969802
p03639
u692632484
1512724307
Python
Python (3.4.3)
py
Runtime Error
17
3064
468
N=int(input()) a=[int(i) for i in input().split()] num4=0 num2=0 num1=0 for i in a: if i%4==0: num4+=1 elif i%2==0: num2+=1 num1=N-num4-num2 if num2>0: num1+=1 if num1<=num4+1: print("Yes") else: print("No") ...
s885120613
p03639
u676264453
1508281118
Python
Python (3.4.3)
py
Runtime Error
19
3064
303
import sys N = int(input()) ls = list(map(int, input().split())) k = len(ls) p = [ i for i in ls if (i%4) == 0] j = [ i for i in ls if (i%4) != 0] r = [ i for i in j if (i%2) == 0] if(len(p) >= int(k/2)): print('Yes') elif (len(p) >= (len(j) - len(r))): print('Yes') else: print('No') ----
s788439737
p03639
u876770991
1507726710
Python
Python (2.7.6)
py
Runtime Error
2104
15920
1027
raw_input() l = map(int, raw_input().split()) memo = {} def get_min(l): if (l[0], l[-1]) in memo: return memo[(l[0], l[-1])] r = [(_, idx) for idx, _ in enumerate(l) if idx % 2 == 0] first_val, first_idx = min(r) r = [(_, idx) for idx, _ in enumerate(l) if idx % 2 != 0 and idx > first_idx] ...
s301718263
p03639
u677320550
1505795637
Python
Python (3.4.3)
py
Runtime Error
17
2940
242
n = int(input()) q=0 w=0 e=0 a = list(map(int, input().split())) for b in a: if b % 2 ==0&& b % 4!=0: q+=q elif b%4 ==0: e+=e elif b%2!=0: w+=w q=q/2 q=q+e if(w<=q): print("Yes") else: print("No")
s921702105
p03639
u677320550
1505795175
Python
Python (3.4.3)
py
Runtime Error
17
2940
230
n = int(input()) q=0 w=0 e=0 a = list(map(int, input().split())) for b in a: if b % 2 ==0: q+=q elif b%4 ==0: e+=e elifb%2!=0: w+=w q=q/2 q=q+e if(w<=q): print("Yes") else: print("No")
s138412060
p03639
u774160580
1503893266
Python
Python (3.4.3)
py
Runtime Error
61
15192
242
N = int(input()) tmp = input() A = [int(a) for a in tmp.split()] num_4 = sum([ 1 for i in A if i%4 == 0]) num_2 = sum([ 1 for i in A if i%2 == 0]) - num_4 num_odd = N - num_2 - num4 if num_4 > num_odd: print("Yes") else: print("No")
s851202103
p03639
u886545507
1503492682
Python
Python (2.7.6)
py
Runtime Error
10
2568
298
#ARc080C n=int(raw_input()) l=map(int,raw_input().split()) cnt1=cnt2=cnt4=0 for i in xrange(n): if (l[i]%2)%2==0: cnt4+=1 elif l[i]%2==0: cnt2+1=1 elif l[i]%2: cnt1+=1 if cnt2==0: if cnt1<=cnt4+1: print 'Yes' else: print 'No' else: if cnt1<=cnt4: print 'Yes' else: print 'No'
s052437444
p03639
u858994158
1502599218
Python
Python (3.4.3)
py
Runtime Error
17
2940
187
input() xs=list(map(int, input().split())) f,t,z=0,0,0 for x in xs: if x % 4 == 0: f+=1 elif x % 2 == 0: t += 1 else: z += 1 z += t print('Yes' if z + 1 < f then 'No')
s241316552
p03639
u330205771
1502073161
Python
Python (3.4.3)
py
Runtime Error
2104
14660
599
N = int(input()) p = list(map(int, input().split())) q = [] summation = [p[i] + p[i + 1] for i in range(N - 1)] for i in range(int(N / 2)): if len(p) == 2: q = p + q else: index = summation.index(max(summation)) q = p[index:index + 2] + q p = p[:index] + p[index + 2:] if...
s735713522
p03639
u330205771
1502073135
Python
Python (3.4.3)
py
Runtime Error
1910
147612
630
N = int(input()) p = list(map(int, input().split())) q = [] summation = [p[i] + p[i + 1] for i in range(N - 1)] for i in range(int(N / 2)): if len(p) == 2: q = p + q else: index = summation.index(max(summation)) q = p[index:index + 2] + q p = p[:index] + p[index + 2:] pr...
s083681859
p03639
u419645731
1502068802
Python
Python (3.4.3)
py
Runtime Error
18
3060
83
h, w = map(int,input().split()) n = int(input()) a = list(map(int,input().split()))
s047804105
p03639
u419645731
1502068691
Python
Python (3.4.3)
py
Runtime Error
17
3064
314
h, w = map(int,input().split()) n = int(input()) a = list(map(int,input().split())) grid = [[' ']*w for i in range(h)] ci = 0 for i in range(h): for j in range(w): if not a[ci]: ci+= 1 if i%2==0: grid[i][j] = ci+1 else: grid[i][~j] = ci+1 a[ci]-= 1 for row in grid: print(*row)
s200333336
p03639
u243492642
1502067894
Python
Python (3.4.3)
py
Runtime Error
18
3064
13
6 2 7 1 8 2 8
s107897938
p03640
u248670337
1600988789
Python
Python (3.8.2)
py
Runtime Error
29
9468
131
h,w,n,*A=map(int,open(x:=0).read().split());c=[] for i in range(n):c+=[i+1]*A[i] for i in range(h):print(*(c[i*w:-~i*w])[::x]);x^=1
s879770221
p03640
u350093546
1598578138
Python
PyPy3 (7.3.0)
py
Runtime Error
2254
1233320
337
h,w=map(int,input().split()) n=int(input()) lst=[] for i in range(1,n+1): for j in range(i): lst.append(str(i)) ans=[[0]*w for i in range(h)] for i in range(h): if i%2==0: for j in range(w): ans[i][j]=lst.pop() else: for j in range(w-1,-1,-1): ans[i][j]=lst.pop() for i in ans: p...
s574161642
p03640
u353919145
1594193832
Python
Python (3.8.2)
py
Runtime Error
22
8892
726
#include <bits/stdc++.h> using namespace std; int res[110][110]; int main() { int n, h, w; cin >> h >> w >> n; int x = 0, y = w; for (int i = 1; i <= n; i++) { int a; cin >> a; y += 1; if (y == w + 1) { y = 1; x += 1; } for (int j = x; j <= h; j++) { bool ok = false; int t = (j == x ? y : 1)...
s530702243
p03640
u143051858
1593714894
Python
Python (3.8.2)
py
Runtime Error
2228
670620
334
H,W = map(int,input().split()) N = int(input()) a = list(map(int,input().split())) s = [] res = [] for v,i in enumerate(a,1): for _ in range(v): s.append(str(i)) for i in range(H): for j in range(W): res.append(str(s.pop(0))) if i % 2 == 1: res.reverse() print(' '.join(res)...
s206205413
p03640
u131881594
1592335060
Python
Python (3.4.3)
py
Runtime Error
19
3188
388
h,w=map(int,input().split()) n=int(input()) a=list(map(int,input().split())) colors = [[i+1]*a[i] for i in n] ans=[[0 for _ in range(w)] for _ in range(h)] temp=0 for i in range(h): for j in range(w): if i%2==0: j = w-h-1 ans[i][j]=colors[temp] temp+=1 for i in range(h):...
s324364754
p03640
u153094838
1591367160
Python
Python (3.4.3)
py
Runtime Error
19
3192
765
# -*- coding: utf-8 -*- """ Created on Fri Jun 5 09:50:00 2020 @author: NEC-PCuser """ H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) gazo = [[0] * W for i in range(H)] count = 0 start_H = 0 start_W = 0 direction = 0 for i in range(len(a)): for j in range(a[i]): ...
s206067595
p03640
u586759271
1589852373
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38896
294
#19 Grid Coloring h,w=map(int,input().split() ) n=int(input()) a=list(map(int,input().split())) import numpy as np lis=[] for i in range(n): lis.extend([i+1]*a[i]) lis = np.array(lis).reshape((h,w)) for i in range(1,h,2): lis[i] = lis[i][::-1] for i in range(h): print(*lis[i])
s752585255
p03640
u992910889
1589680906
Python
PyPy3 (2.4.0)
py
Runtime Error
178
39024
379
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): n=int(input()) A=list(map(int,input().split())) val=max(A) val2=0 minabs=10**10 for i in range(n): if abs(A[i]-(val//2))<minabs: minabs=abs(A[i]-(val//2)) ...
s550990185
p03640
u054559808
1589657146
Python
PyPy3 (2.4.0)
py
Runtime Error
257
46440
664
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) field = [[0 for j in range(w)] for i in range(h)] #[y, x] d = [[0, 1], [1, 0], [0, -1], [-1, 0]] y, x = 0, 0 for i in range(n): cnt = a[i] while cnt > 0: for j in range(len(d)): if 0 <= y + d[j][0] and y + ...
s861231175
p03640
u489959379
1589246353
Python
Python (3.4.3)
py
Runtime Error
26
3920
624
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): H, W = map(int, input().split()) n = int(input()) A = list(map(int, input().split())) grid = [[0 for _ in range(W)] for _ in range(W)] h, w = 0, 0 for i in range(n): cnt = A[i] whi...
s159988962
p03640
u638902622
1588989006
Python
Python (3.4.3)
py
Runtime Error
32
4324
2484
import sys ## io ## def IS(): return sys.stdin.readline().rstrip() def II(): return int(IS()) def MII(): return list(map(int, IS().split())) def MIIZ(): return list(map(lambda x: x-1, MII())) ## dp ## def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)] def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in...
s238643235
p03640
u638902622
1588988790
Python
Python (3.4.3)
py
Runtime Error
31
4304
2420
import sys ## io ## def IS(): return sys.stdin.readline().rstrip() def II(): return int(IS()) def MII(): return list(map(int, IS().split())) def MIIZ(): return list(map(lambda x: x-1, MII())) ## dp ## def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)] def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in...
s945751094
p03640
u038724782
1588544842
Python
Python (3.4.3)
py
Runtime Error
27
3572
670
h, w = map(int,input().split()) n = int(input()) a_l = list(map(int,input().split())) ans = [] for _ in range(h): ans.append([0]*w) direction = 0 posx = 0 posy = 0 for i in range(n): for j in range(a_l[i]): ans[posy][posx] = i+1 if direction == 0: posx += 1 if posx == w...
s507611674
p03640
u977193988
1587260624
Python
Python (3.4.3)
py
Runtime Error
28
3920
1553
import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) def main(): H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) C = [[0 for _ in range(W)] for _ in range(H)] h = 0 w = 0 flag = True for i in range(N): ...
s827829310
p03640
u977193988
1587260553
Python
Python (3.4.3)
py
Runtime Error
28
3920
1503
import sys def input(): return sys.stdin.readline().strip() sys.setrecursionlimit(10 ** 9) def main(): H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) C = [[0 for _ in range(W)] for _ in range(H)] h = 0 w = 0 flag = True for i in range(N): ...
s369559327
p03640
u314050667
1586467701
Python
Python (3.4.3)
py
Runtime Error
183
13236
318
import numpy as np H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) s = '' for i in range(N): s += str(i+1) * A[i] B = np.array(list(map(int, s)), np.int64).reshape([H,W]) for i in range(H): if i % 2 == 0: print(*B[i]) else: print(*B[i][::-1])
s070323380
p03640
u790710233
1585224902
Python
Python (3.4.3)
py
Runtime Error
36
4212
542
h, w = map(int, input().split()) n = int(input()) A = list(map(int, input().split())) ans = [[0]*w for _ in range(h)] idx_ls = [(0, 0)] i = j = 0 flip = 0 flag = 1 for _ in range(h*w-1): if (j == w-1 or j == 0)and not flag: i += 1 flip ^= 1 flag = 1 idx_ls.append((i, j)) con...
s694627931
p03640
u513434790
1578600164
Python
Python (3.4.3)
py
Runtime Error
201
13052
624
import numpy as np H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) m = np.argsort(a)[::-1] n = [str(i+1) for i in m] c = [a[i] for i in m] ans = ["" for _ in range(H)] j = 0 for i in range(H): count = 0 while count != W: if count + c[i] <= W: ans[i] +=...
s549794507
p03640
u513434790
1578599987
Python
Python (3.4.3)
py
Runtime Error
202
13140
597
import numpy as np H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) m = np.argsort(a)[::-1] n = [str(i+1) for i in m] c = [a[i] for i in m] ans = ["" for _ in range(H)] j = 0 for i in range(H): count = 0 while count != W: if count + c[i] <= W: ans[i] +=...
s587265175
p03640
u898967808
1576902127
Python
Python (3.4.3)
py
Runtime Error
26
3188
365
h,w = map(int,input().split()) n = int(input()) aa = list(map(int,input().split())) ans = [[0]*w for _ in range(h)] nums = '' for i in range(n): nums += str(i+1)*aa[i] for i in range(len(nums)): ans[i//w][i%w] = nums[i] for hi in range(h): if hi % 2 == 1: print(' '.join(list(reversed(ans[h...
s974226297
p03640
u109617108
1574817555
Python
PyPy3 (2.4.0)
py
Runtime Error
235
44392
452
H,W=map(int,input().split()) N=int(input()) L=list(map(int,input().split())) col=0 M=W*[[0]*H] for i in range(H): if i%2==0: for j in range(W): if L[col]>0: M[i][j]=col+1 L[col]-=1 if L[col]==0: col+=1 else: for j in range(W-1,0,-1): if L[col]>0: M[i][j]=col...
s143467382
p03640
u109617108
1574817394
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38896
452
H,W=map(int,input().split()) N=int(input()) L=list(map(int,input().split())) col=0 M=W*([0]*H) for i in range(H): if i%2==0: for j in range(W): if L[col]>0: M[i][j]=col+1 L[col]-=1 if L[col]==0: col+=1 else: for j in range(W-1,0,-1): if L[col]>0: M[i][j]=col...
s975953338
p03640
u672220554
1569362771
Python
Python (3.4.3)
py
Runtime Error
31
3188
702
h,w = map(int,input().split()) n = int(input()) a = list(map(int,input().split())) res = [] for _ in range(h): res.append("") line = 0 def insert(res,i,l): if l %2 == 0: res[l] = res[l] + str(i+1) else: res[l] = str(i+1) + res[l] for i in range(0,n): ammount=a[i] while len(res[lin...
s563175525
p03640
u672220554
1569362322
Python
Python (3.4.3)
py
Runtime Error
28
3188
654
h,w = map(int,input().split()) n = int(input()) a = list(map(int,input().split())) res = [] for _ in range(h): res.append("") line = 0 def insert(res,i,l): if l %2 == 0: res[l] = res[l] + str(i+1) else: res[l] = str(i+1) + res[l] for i in range(0,n): ammount=a[i] while len(res[lin...
s278682420
p03640
u672220554
1569362115
Python
Python (3.4.3)
py
Runtime Error
31
3188
626
h,w = map(int,input().split()) n = int(input()) a = list(map(int,input().split())) res = [] for _ in range(h): res.append("") line = 0 def insert(res,i,l): if l %2 == 0: res[l] = res[l] + str(i+1) else: res[l] = str(i+1) + res[l] for i in range(0,n): ammount=a[i] while len(res[lin...
s117718660
p03640
u291766461
1568607738
Python
Python (3.4.3)
py
Runtime Error
29
3700
748
H, W = list(map(int, input().split())) N = int(input()) A = list(map(int, input().split())) res = [["" for _ in range(W)] for h in range(H)] start_y, start_x = 0, -1 pos_y, pos_x = start_y, start_x dy, dx = 0, 1 for idx, a in enumerate(A, 1): for i in range(a): pos_x += dx pos_y += dy res[po...
s466899088
p03640
u504562455
1567456585
Python
Python (3.4.3)
py
Runtime Error
17
3064
466
H, W = [int(i) for i in input().split()] N = int(input()) a = [int(i) for i in input().split()] c = [[0 for j in range(W)] for i in range(H)] w = 0 h = 0 for i in range(N): for j in range(a[i]): c[h][w] = i+1 if h%2 == 0: if w < W - 1: w += 1 else: ...
s201801849
p03640
u665038048
1563933768
Python
Python (3.4.3)
py
Runtime Error
17
3064
259
n = int(input()) a = list(map(int, input().split())) c = [] for i in range(n): c += [i+1]*a[i] ans = [] for h_ in range(h): a = c[h_*w: w+h_*w] if h_ % 2 == 0: ans.append(a) else: ans.append(a[::-1]) for i in ans: print(*i)
s748847574
p03640
u665038048
1563933649
Python
Python (3.4.3)
py
Runtime Error
20
3188
292
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) c = [] for i in range(n): c += (n+1)*a[n] ans = [] for h_ in range(h): a = c[h_*w: w+h_*w] if h_ % 2 == 0: ans.append(a) else: ans.append(a[::-1]) for i in ans: print(*i)
s436986295
p03640
u665038048
1563933599
Python
Python (3.4.3)
py
Runtime Error
19
3188
289
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) c = [] for i in range(n): c += (n+1)*a[n] ans = [] for h_ in range(h): a = c[h*w: w+h*w] if h % 2 == 0: ans.append(a) else: ans.append(a[::-1]) for i in ans: print(*i)
s711977279
p03640
u623687794
1563473826
Python
Python (3.4.3)
py
Runtime Error
19
3188
359
h,w=map(int,input().split()) n=int(input()) c=list(map(int,input().split())) d=[] for i in range(1,n+1): for j in c[i-1]: d.append(i) ansl=[[0]*w for i in range(h)] for i in range(h): if i%2==0: for j in range(w): ansl[i][j]=str(d[i*w+j]) else: for j in range(w): ansl[i][w-j-1]=str(d[i*w+j...
s314126460
p03640
u623687794
1563473672
Python
PyPy3 (2.4.0)
py
Runtime Error
171
39024
358
h,w=map(int,input().split()) n=int(input()) c=list(map(int,input().split())) d=[] for i in range(1,n+1): for j in c[i-1]: d.append(i) ansl=[[0]*w for i in range(h)] for i in range(h): if i%2==0: for j in range(w): ansl[i][j]=str(d[i*w+j]) else: for j in range(w): ansl[i][w-j-1]=str(d[i*w+j...
s145378069
p03640
u167681750
1561578338
Python
Python (3.4.3)
py
Runtime Error
23
4468
275
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) ans_list = ([[i+1] * a[i] for i in range(N)]) ans_list = reduce(lambda a, b: a + b, ans_list) for i in range(H): print(ans_list[i*W:i*W+W] if i%2 == 0 else ans_list[i*W+W-1:i*W-1:-1])
s152221587
p03640
u463655976
1560474356
Python
Python (3.4.3)
py
Runtime Error
18
2940
254
H, W = map(int, input().split()) N = int(input()) i = 0 buf = [0] * W k = 1 for x, ai in aip(range(1, N+1), map(int, input().split())): for _ in range(ai) buf[i] = x i += 1 if i >= W: print(" ".join(buf[::k])) i = 0 k = -k
s556053484
p03640
u502389123
1558279565
Python
Python (3.4.3)
py
Runtime Error
85
4500
622
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) K = [] for i in range(N): for j in range(a[i]): K.append(i+1) maze = [[0] * W for _ in range(H)] def dfs(x, y, p, i): if y < 0 or y >= H or i >= H*W: return if 0 <= x < W: maze[y][x] = K[i] ...
s916724906
p03640
u502389123
1558278404
Python
Python (3.4.3)
py
Runtime Error
84
4512
610
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) K = [] for i in range(N): for j in range(a[i]): K.append(i+1) maze = [[0] * W for _ in range(H)] def dfs(x, y, p, i): if y < 0 or y >= H: return if 0 <= x < W: maze[y][x] = K[i] if x < 0: ...
s360566543
p03640
u496744988
1557317911
Python
PyPy3 (2.4.0)
py
Runtime Error
286
66160
1477
from collections import deque import sys def LI(): return [int(x) for x in sys.stdin.readline().split()] def MI(): return map(int, sys.stdin.readline().split()) def II(): return int(sys.stdin.readline()) H, W = MI() N = II() a = LI() color = deque() ans = [[0] * W for _ in range(H)] # visited = [[0] * W for _ in rang...
s277856943
p03640
u967835038
1554187461
Python
Python (3.4.3)
py
Runtime Error
26
3188
292
height, wide = map(int, input().split()) n = int(input()) anstr = '' a = list(map(int, input().split())) for i in range(n): for j in range(a[i]): anstr += str(i) for k in range(n/wide): if k % 2 == 0: print(anstr[k:k+wide]) else: print(anstr[k:k+wide:-1])
s211522879
p03640
u627417051
1552761072
Python
Python (3.4.3)
py
Runtime Error
755
394484
436
H, W = list(map(int, input().split())) N = int(input()) A = [] a = list(map(int, input().split())) for i in range(N): A += [a[i]] * (i + 1) L = [[0 for i in range(W)] for j in range(H)] for i in range(H * W): if int((i // W)) % 2 == 0: L[int((i // W))][i % W] = A[i] else: L[int((i // W))][-...
s533828604
p03640
u411858517
1551633546
Python
Python (3.4.3)
py
Runtime Error
35
3572
704
H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) res = [[-1 for _ in range(W)] for _ in range(H)] x = 0 y = 0 for i in range(N): if x + A[i] <= W: for j in range(A[i]): res[y][x + j] = i + 1 x = x + A[i] else: fo...
s092084320
p03640
u572144347
1551449106
Python
Python (3.4.3)
py
Runtime Error
24
3188
494
H,W=map(int,input().split()) N=int(input()) A=list(map(int,input().split())) nc=1 nct=A[0] ans=[] for y in range(H): if y%2==0: st="" for x in range(W): nct-=1 st+=str(nc) if nct==0 and nc!=N: nct=A[nc] nc+=1 else: st="" for x in range(W-1,-1,-1): nc-=1 ...
s908265102
p03640
u054106284
1550015423
Python
Python (3.4.3)
py
Runtime Error
31
4084
378
H, W = (int(i) for i in input().split()) N = int(input()) A = [int(i) for i in input().split()] C = [] for i in range(N): for j in range(A[i]): C.append(i+1) ans = [[0]*W for i in range(H)] for i in range(H*W): y = i // W if y%2==0: x = i%W else: x = W-1-i%W ans[x][y] = C[i] for i in range(H): a...
s175268616
p03640
u054106284
1550015250
Python
Python (3.4.3)
py
Runtime Error
19
3188
377
H, W = (int(i) for i in input().split()) N = int(input()) A = [int(i) for i in input().split()] C = [] for i in range(N): for j in range(a[i]): C.append(i+1) ans = [[0]*W for i in range(H)] for i in range(HW): y = i // W if y%2==0: x = i%W else: x = W-1-i%W ans[x][y] = C[i] for i in range(H): an...
s124387732
p03640
u848647227
1545881717
Python
Python (3.4.3)
py
Runtime Error
81
11636
613
a,b= map(int,input().split(" ")) b = int(input()) ar = list(map(int,input().split(" "))) br = [[0 for i in range(b)] for j in range(a)] go = "M" ap = 1 for i in range(a): if go == "M": for j in range(b): if ar[0] == 0: del ar[0] ap += 1 br[i][j] = ap ...
s325333910
p03640
u817328209
1519708267
Python
Python (3.4.3)
py
Runtime Error
19
3188
532
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) c = [[0 for i in range(w)] for j in range(h)] fromL = True x = 0 y = 0 for i in range(1, n+1) : for j in range(a[i-1]) : c[y][x] = i if w == 1 : y += 1 elif j > 0 and x == w - 1 : ...
s755957308
p03640
u676264453
1508455747
Python
PyPy3 (2.4.0)
py
Runtime Error
204
42096
653
def draw(i): global p,q,hd,wd B[p][q] = i if (q < W-1 and hd != -1): hd = 1 wd = 0 elif (hd == 1 and q == W-1) or (hd == -1 and q == 0): hd = 0 wd = 1 else: hd = -1 wd = 0 p += wd q += hd if __name__ == '__main__': p = 0 q = 0 hd ...
s134727299
p03640
u676264453
1508455715
Python
Python (2.7.6)
py
Runtime Error
11
2696
653
def draw(i): global p,q,hd,wd B[p][q] = i if (q < W-1 and hd != -1): hd = 1 wd = 0 elif (hd == 1 and q == W-1) or (hd == -1 and q == 0): hd = 0 wd = 1 else: hd = -1 wd = 0 p += wd q += hd if __name__ == '__main__': p = 0 q = 0 hd ...
s882504413
p03640
u676264453
1508455111
Python
Python (3.4.3)
py
Runtime Error
31
3572
653
def draw(i): global p,q,hd,wd B[p][q] = i if (q < W-1 and hd != -1): hd = 1 wd = 0 elif (hd == 1 and q == W-1) or (hd == -1 and q == 0): hd = 0 wd = 1 else: hd = -1 wd = 0 p += wd q += hd if __name__ == '__main__': p = 0 q = 0 hd ...
s933312142
p03640
u676264453
1508454335
Python
Python (3.4.3)
py
Runtime Error
32
3572
650
def draw(i): global p,q,hd,wd B[p][q] = i if (q < W-1 and hd != -1): hd = 1 wd = 0 elif (hd == 1 and q == W-1) or (hd == -1 and q == 0): hd = 0 wd = 1 else: hd = -1 wd = 0 p += wd q += hd if __name__ == '__main__': p = 0 q = 0 hd ...
s118342487
p03640
u676264453
1508453839
Python
Python (3.4.3)
py
Runtime Error
31
3572
651
def draw(i): global p,q,hd,wd B[p][q] = i if (q < W-1 and hd != -1): hd = 1 wd = 0 elif (hd == 1 and q == W-1) or (hd == -1 and q == 0): hd = 0 wd = 1 else: hd = -1 wd = 0 p += wd q += hd if __name__ == '__main__': p = 0 q = 0 hd ...
s243465104
p03640
u363299657
1508282988
Python
Python (2.7.6)
py
Runtime Error
16
2820
525
h, w = map(int, raw_input().split()) n = int(raw_input()) aa = map(int, raw_input().split()) p = dict() for a in aa: if a in p: p[a] += a else: p[a] = a b = [[None]*w]*h print p f = True ks = set(p.keys()) for i in range(h): for j in range(w): c = ks[0] if f: b...
s253465103
p03640
u830580569
1502213648
Python
Python (2.7.6)
py
Runtime Error
13
2820
748
def grid_coloring(): h,w = map(int, raw_input().split(" ")) n = int(raw_input()) a = map(int, raw_input().split(" ")) _current_color = 1 ans = np.zeros((h,w), dtype=int) for i in range(h): if i%2==0: for j in reversed(range(w)): if a[_current_color-1]!=0: ans[i][j]=_current_color a[_current_col...
s355213618
p03640
u548384403
1502069165
Python
Python (2.7.6)
py
Runtime Error
15
3076
419
[H,W]=[int(x) for x in raw_input().split()] N=int(raw_input()) A=[int(x) for x in raw_input().split()] B=[[0 for x in range(W)] for y in range(H)] p=0 q=0 d=1 k=0 for i in range(1,N+1): for j in range(A[i-1]): B[p][(q+k)*d]=i q+=1 if q==N: p+=1 q=0 d*=-1 ...
s102178802
p03641
u875291233
1594862400
Python
PyPy3 (7.3.0)
py
Runtime Error
1027
158100
2773
class segment_tree: def __init__(self, N, operator_M, e_M): self.op_M = operator_M self.e_M = e_M self.N0 = 1<<(N-1).bit_length() self.dat = [self.e_M]*(2*self.N0) # 長さNの配列 initial で初期化 def build(self, initial): self.dat[self.N0:self.N0+len(initial)] = i...
s602960631
p03641
u163320134
1592719280
Python
PyPy3 (7.3.0)
py
Runtime Error
1373
168560
1835
import heapq import sys input=sys.stdin.readline class SegmentTreeMin(): def __init__(self,n,init): self.offset=2**((n-1).bit_length()) self.tree=[init]*(2*self.offset) self.init=init def update(self,pos,val): pos+=self.offset self.tree[pos]=val while pos>1: pos=pos//2 self.tree...
s248649712
p03641
u163320134
1592719131
Python
Python (3.8.2)
py
Runtime Error
2206
44456
1835
import heapq import sys input=sys.stdin.readline class SegmentTreeMin(): def __init__(self,n,init): self.offset=2**((n-1).bit_length()) self.tree=[init]*(2*self.offset) self.init=init def update(self,pos,val): pos+=self.offset self.tree[pos]=val while pos>1: pos=pos//2 self.tree...
s722963013
p03641
u532966492
1591233616
Python
PyPy3 (2.4.0)
py
Runtime Error
2060
138572
3854
def main(): n = int(input()) p = list(map(lambda x: int(x)-1, input().split())) pos = [j for i, j in sorted([(j, i) for i, j in enumerate(p)])] class segtree(): def __init__(self, base, monoid, ini): # self,モノイド,元の配列 # ini:上限(下限),base:元の配列,monoid:モノイド,tree:セグ木,depth:treeの深さ, ...
s586004882
p03641
u677523557
1583600516
Python
PyPy3 (2.4.0)
py
Runtime Error
2113
143824
2405
# AOJ DSL_2_A "Range Minimum Query" # SegmantTreeの実装 import sys input = sys.stdin.readline # 初期化最大値 INF = (1 << 31) - 1 class SegmentTree: def __init__(self, N): self.N = 2**(N-1).bit_length() self.data = [[INF, -1] for _ in range(2*self.N-1)] # k番目の値(0-indexed)をaに変更 def update(self, k, a...
s769288435
p03641
u742529680
1578343747
Python
Python (3.4.3)
py
Runtime Error
17
2940
2317
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; typedef long long ll; template<class T> using V = vector<T>; template<class T> using VV = V<V<T>>; #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i,n) rep2(i,0,n) #define rep2(i,...
s549700493
p03641
u310678820
1576550184
Python
PyPy3 (2.4.0)
py
Runtime Error
2110
125436
1711
class SegmentTree:#抽象セグ木 def __init__(self, N, id, fun):#id:単位元 self.N0 = 2**(N-1).bit_length() self.id = id self.data = [(self.id, -1)]*(2*self.N0) self.fun = fun def update(self, i, x): k=i+self.N0-1 self.data[k] = (x, i) while k>=0: k = (k-1...
s797424901
p03641
u310678820
1576533533
Python
PyPy3 (2.4.0)
py
Runtime Error
2122
375724
1779
class SegmentTree:#抽象セグ木 def __init__(self, N, id, fun):#id:単位元 self.N0 = 2**(N-1).bit_length() self.id = id self.data = [(self.id, i) for i in range(2*self.N0)] self.fun = fun def update(self, k, x): k+=self.N0-1 self.data[k] = (x, k-self.N0+1) while k>=0...
s267688793
p03641
u353797797
1576011697
Python
Python (3.4.3)
py
Runtime Error
2106
40308
3022
from heapq import * import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] class Segt...
s799719974
p03641
u368780724
1575997157
Python
PyPy3 (2.4.0)
py
Runtime Error
1522
123080
3280
import sys readline = sys.stdin.readline from heapq import heappop as hpp, heappush as hp class Segtree: def __init__(self, A, intv, initialize = True, segf = max): self.N = len(A) self.N0 = 2**(self.N-1).bit_length() self.intv = intv self.segf = segf if initialize: ...
s238203701
p03641
u368780724
1575995987
Python
PyPy3 (2.4.0)
py
Runtime Error
2110
133660
4653
import sys readline = sys.stdin.readline class Dualsegtree: def __init__(self, A, intv, initialize = True): self.N = len(A) self.N0 = 2**(self.N-1).bit_length() self.intv = intv self.segf = min if initialize: self.data = [intv]*(self.N0-1) + A + [intv]*(self.N0 - ...