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
s381739279
p03638
u425184437
1599727689
Python
PyPy3 (7.3.0)
py
Runtime Error
88
69460
486
H,W=map(int,input().split()) N=int(input()) A=list(map(int,input().split())) a=[0 for i in range(H*W)] b=[0 for i in range(N)] b[0]=A[0] for i in range(1,N): b[i]=b[i-1]+A[i] for i in range(N): if i==0: for j in range(b[i]): a[j]=1 else: for j in range(b[i-1],b[i]): a[j]=i+1 ans=[[0 for ...
s613520008
p03638
u869790980
1596977259
Python
PyPy2 (7.3.0)
py
Runtime Error
469
86444
744
h, w= map(int, raw_input().split()) n = int(raw_input()) ais = map(int, raw_input().split()) ais.sort(key = lambda x:-x) mat = [[-1 for _ in range(w)] for ii in range(h)] import collections color = 0 vis = set([]) def bfs(start, color, count,mat): q = collections.deque([start]) vis = set([start]) while(q and count)...
s012111941
p03638
u869790980
1596977203
Python
PyPy2 (7.3.0)
py
Runtime Error
401
86720
738
h, w= map(int, raw_input().split()) n = int(raw_input()) ais = map(int, raw_input().split()) ais.sort(key = lambda x:-x) mat = [[-1 for _ in range(w)] for ii in range(h)] import collections color = 0 vis = set([]) def bfs(start, color, count,mat): q = collections.deque([start]) vis = set([start]) while(count): co...
s293195539
p03638
u869790980
1596977121
Python
PyPy2 (7.3.0)
py
Runtime Error
81
73948
729
h, w= map(int, raw_input().split()) n = int(raw_input()) ais = map(int, raw_input().split()) ais.sort() mat = [[-1 for _ in range(w)] for ii in range(h)] import collections color = 0 vis = set([]) def bfs(start, color, count, vis,mat): q = collections.deque([start]) vis = set([start]) while(count): count -=1 cu...
s640509124
p03638
u869790980
1596977056
Python
PyPy2 (7.3.0)
py
Runtime Error
83
79576
727
h, w= map(int, raw_input().split()) n = int(raw_input()) ais = map(int, raw_input().split()) ais.sort() mat = [[-1 for _ in range(w)] for ii in range(h)] import collections color = 0 vis = set([]) def bfs(start, color, count, vis,mat): q = collections.deque([start]) vis = set([start]) while(count): count -=1 cu...
s801623369
p03638
u208713671
1596075503
Python
PyPy3 (7.3.0)
py
Runtime Error
96
74756
408
H,W = list(map(int,input().split())) N = int(input()) A = list(map(int,input().split())) cnt = 0 L = [] i = 1 while cnt<H*W: if A[i-1]>0: A[i-1]+=-1 L.append(i) cnt+=1 else: i+=1 for i in range(H): out = [0]*W if i%2==0: for j in range(W): out[j]=L[H*i...
s876044901
p03638
u968166680
1595970988
Python
Python (3.8.2)
py
Runtime Error
40
9680
606
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): H, W, N, *A = map(int, read().split()) C = [[0] * W for _ in range(H)] vec = [i for i, a in enumerate(A, 1) for _ in range(a)] for...
s213080486
p03638
u790012205
1594207753
Python
Python (3.8.2)
py
Runtime Error
47
9644
462
H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) D = {} for i in range(N): D[i + 1] = A[i] C = '' for k, v in D.items(): C += v * str(k) while True: c = C[:W] for i in range(W): print(c[i], end=' ') print('') if len(C) == W: break C = C[W:...
s932440572
p03638
u790012205
1594205161
Python
Python (3.8.2)
py
Runtime Error
50
10176
513
H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) D = {} for i in range(N): D[i + 1] = A[i] D = sorted(D.items(), key=lambda x: x[1], reverse=True) C = '' for d in D: C += d[1] * str(d[0]) while True: c = C[:W] for i in range(W): print(c[i], end=' ') print...
s016185966
p03638
u941047297
1591815758
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38256
584
def main(): def flatten_list(l): for el in l: if isinstance(el, list): yield from flatten_list(el) else: yield el H, W = list(map(int, input().split())) n = int(input()) A = list(map(int, input().split())) ans = [] for i, a in enume...
s200804548
p03638
u845620905
1589935691
Python
Python (3.4.3)
py
Runtime Error
31
3700
557
H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) h = 0 w = 0 plus = 1 side = 0 maze = [["-1" for i in range(W)] for _ in range(H)] for i in range(N): for j in range(A[i]): maze[h][w] = str(i+1) if side: side = 1 - side w += 1 else...
s056175929
p03638
u192154323
1589727013
Python
Python (3.4.3)
py
Runtime Error
29
3956
520
from collections import deque H,W = map(int,input().split()) n = int(input()) a_ls = list(map(int, input().split())) color_q = deque() for color, times in enumerate(a_ls,1): for _ in range(times): color_q.append(color) ans_mat = [[0] * W for _ in range(W)] for y in range(H): for x in range(W): a...
s457086554
p03638
u025501820
1589602056
Python
Python (3.4.3)
py
Runtime Error
50
5108
784
#!/usr/bin/env python3 from collections import deque H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) A.insert(0, 0) done = [[True for _ in range(W)] for _ in range(H)] ans = [[-1 for _ in range(W)] for _ in range(H)] q = deque([(0, 0, 1)]) color = 1 while q: x, y, color = q...
s290808184
p03638
u980783809
1589067840
Python
Python (3.4.3)
py
Runtime Error
30
4212
988
h, w = map(int, input().split()) n = int(input()) colors = list(map(int, input().split())) cmap = [(i+1,a) for i,a in enumerate(colors)] campus=[0]*(h*w) def printmtrx(campus): ts="" for idx,i in enumerate(campus): if((idx+1)%w==1): if idx==0: ts += str(i) + " " ...
s588121736
p03638
u426764965
1589061750
Python
Python (3.4.3)
py
Runtime Error
154
12592
549
import numpy as np def abc069_d(): H, W = map(int, input().split()) _ = int(input()) A = list(map(int, input().split())) # γ„γ£γŸγ‚“1欑元に並べる flat = [] for i, a in enumerate(A): flat += [i+1] * a # 2欑元に倉归して、1θ‘Œι£›γ°γ—γ§εθ»’(ζŠ˜γ‚ŠθΏ”γ—γ¦εΎ€εΎ©γ™γ‚Œγ°γ€γͺγŒγ‚‹) grid = np.array(flat, dtype=int).reshape((H, W)) ...
s200391876
p03638
u980783809
1589057546
Python
Python (3.4.3)
py
Runtime Error
2104
4656
2170
h, w = map(int, input().split()) n = int(input()) colors = list(map(int, input().split())) cmap = {i+1:a for i,a in enumerate(colors)} colors = sorted(cmap.items(),key=lambda x:x[1],reverse=True) campus=[0]*(h*w) def printmtrx(campus): ts="" for idx,i in enumerate(campus): if((idx+1)%w==1): ...
s724105326
p03638
u375695365
1588999470
Python
Python (3.4.3)
py
Runtime Error
37
3920
912
h,w=map(int,input().split()) n=int(input()) a=list(map(int,input().split())) ans=[[0]*w for _ in range(h)] i=0 j=0 jugh=0 for z in range(n): count=0 while count<a[z]: #print(i,j,z+1) if jugh==0: ans[i][j]=z+1 j+=1 c=0 elif jugh==2: if j==0...
s382218392
p03638
u426572476
1586477248
Python
Python (3.4.3)
py
Runtime Error
58
6068
2329
import sys from heapq import heappush, heappop, heappushpop, heapify, heapreplace from itertools import permutations from bisect import bisect_left, bisect_right from collections import Counter, deque from fractions import gcd from math import factorial, sqrt INF = 1 << 60 sys.setrecursionlimit(10 ** 6) class UnionFin...
s566710710
p03638
u152638361
1584138048
Python
Python (3.4.3)
py
Runtime Error
33
3956
435
H, W = map(int,input().split()) N = int(input()) a = list(map(int,input().split())) b =[0]*(H*W) k = 0 for i in range(N): for j in range(a[i]): b[k] = i + 1 k += 1 x, y = 0, 0 ans =[[0]*W for i in range(W)] for i in range(H*W): ans[y][x] = b[i] if x == 0 and y%2 == 1 or x == W - 1 and y%2 ==...
s630957205
p03638
u476604182
1582485190
Python
Python (3.4.3)
py
Runtime Error
151
12484
218
import numpy as np H, W, N, *A = map(int, open('0').read().split()) ls = [] for i in range(N): ls += [str(i+1)]*A[i] ls = np.array(ls) ls = ls.reshape((H,W)) ls[1::2] = ls[1::2,::-1] for a in ls: print(' '.join(a))
s873832893
p03638
u186838327
1582112292
Python
PyPy3 (2.4.0)
py
Runtime Error
171
39280
262
w = map(int, input().split()) n = int(input()) l = list(map(int, input().split())) ans = [] for i in range(n): ans += [i+1]*l[i] for i in range(h): temp = ans[i*w:(i+1)*w] if i%2 == 0: print(*temp) else: temp = reversed(temp) print(*temp)
s105658185
p03638
u368796742
1581525816
Python
Python (3.4.3)
py
Runtime Error
29
3920
707
h,w = map(int,input().split()) n = int(input()) l = list(map(int,input().split())) ans = [[0]*w for i in range(h)] x,y = 0,0 z = 1 num = 1 for i in range(n): count = 0 while count < l[i]: ans[x][y] = i+1 count += 1 if z == 1: if y < w-1: y += 1 els...
s838608670
p03638
u347640436
1580879067
Python
Python (3.4.3)
py
Runtime Error
19
3188
384
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) result = [[None] * W for _ in range(H)] d = 1 x, y = 0, 0 for i in range(N): t = a[i] while t > 0: result[y][x] = i + 1 if x == 0 or x == W - 1: d = -d y += 1 else: ...
s304762797
p03638
u691896522
1580711978
Python
PyPy3 (2.4.0)
py
Runtime Error
235
43752
486
h, w = list(map(int, input().split())) n = int(input()) ans = [[0 for i in range(w)] for j in range(w)] dec = 1 p = 1 cnt = 0 index = 0 a = list(map(int, input().split())) for i in range(h): while 0 <= index < w: if cnt == a[p-1]: p += 1 cnt = 0 ans[i][index] = p cnt ...
s669642136
p03638
u309141201
1579668979
Python
Python (3.4.3)
py
Runtime Error
32
3972
700
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) answer = [[0] * W] * H # True_answer = [] input_list = [] for i in range(1, N+1): for _ in range(a[i-1]): input_list.append(i) for i in range(H): for j in range(W): if i % 2 == 0: # print('2') ...
s734278743
p03638
u554954744
1578875724
Python
PyPy3 (2.4.0)
py
Runtime Error
194
41456
305
H, W = map(int, input().split()) N = int(input()) A = list(map(int, input().split())) x = 0 for i in range(H): ans = [] for j in range(W): ans.append(x+1) A[i] -= 1 if A[i] == 0: x += 1 if i % 2 == 0: print(*ans) else: print(*ans[::-1])
s932211069
p03638
u305366205
1576632547
Python
Python (3.4.3)
py
Runtime Error
2104
4076
664
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) grid = [[0] * w for _ in range(h)] cnt = 0 def dfs(x, y, num): for i in range(-1, 2): for j in range(-1, 2): next_x = x + i next_y = y + j global cnt if 0 <= next_x and nex...
s144191714
p03638
u923659712
1576040980
Python
Python (3.4.3)
py
Runtime Error
17
3060
180
n=int(input()) a=list(map(int,input().split())) j=0 k=0 l=0 for i in a: if i%4==0: l+=1 elif i%2==0: k+=1 else: j+=1 if l<=j : print("Yes") else: print("No")
s086006227
p03638
u936985471
1574518416
Python
Python (3.4.3)
py
Runtime Error
18
2940
363
H,W=map(int,input().split()) n=int(input()) a=list(map(int,input().split())) grid=[[0 for i in range(W)] for j in range(H)] cur=0 curcnt=0 for i in range(H): for j in range(W): p=j if i%2==1: p=W-1-j grid[i][p]=cur+1 curcnt+=1 if curcnt=a[cur]: cur+=1 curcnt=0 for i in ra...
s763301788
p03638
u520276780
1573701644
Python
PyPy3 (2.4.0)
py
Runtime Error
249
46952
333
h,w = map(int, input().split()) n = int(input()) a = list(map(int, input().split( ))) ans = [] for i in range(n): for _ in range(a[i]): ans.append(i+1) for i in range(h): for j in range(w): if i%2: print(ans[h*i+j], end = " ") else: print(ans[h*i+w-j-1],end = " "...
s570982524
p03638
u520276780
1573701570
Python
PyPy3 (2.4.0)
py
Runtime Error
248
46952
344
h,w = map(int, input().split()) n = int(input()) a = list(map(int, input().split( ))) ans = [] for i in range(n): for _ in range(a[i]): ans.append(i+1) for i in range(h): for j in range(w): if i%2: print(ans[h*i+j], end = " ") else: print(ans[h*i+w-j-1],end = " "...
s232888709
p03638
u638795007
1573102631
Python
PyPy3 (2.4.0)
py
Runtime Error
195
40944
657
import sys def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) mod = 10**9 + 7 inf = float('inf') H, W =LI() N = I() a = LI() c = [[0]*W for i in range(H)] k = int(0) cur = int(0) kin = int(0) for i,anum in enumerate(a): # print(k,cur) for j in range(anum): ...
s508737100
p03638
u593590006
1571878122
Python
PyPy3 (2.4.0)
py
Runtime Error
198
41840
395
n,m=map(int,input().split()) x=int(input()) l=[int(i) for i in input().split()] mat=[[0 for j in range(m)]for i in range(n)] curr=1 c=0 j=0 for i in range(n): for j in range(m): mat[i][j]=curr c+=1 if c==l[j]: curr+=1 j+=1 c=0 for i in range(n): ...
s369213142
p03638
u644907318
1571313858
Python
Python (3.4.3)
py
Runtime Error
80
3956
627
def put(i): global n,row,cur if cur[0]>W-1 or cur[0]<0: B.append(row) row = ["." for _ in range(W)] if cur==[-1,"L"]: cur = [0,"R"] elif cur==[W,"R"]: cur = [W-1,"L"] if n==0: return row[cur[0]] = i n -= 1 if cur[1]=="R": cu...
s859006625
p03638
u644907318
1571313395
Python
Python (3.4.3)
py
Runtime Error
79
4028
631
def put(i,n): global row,cur if cur[0]>W-1 or cur[0]<0: B.append(row) row = ["." for _ in range(W)] if cur==[-1,"L"]: cur = [0,"R"] elif cur==[W,"R"]: cur = [W-1,"L"] if n==0: return row[cur[0]] = i n -= 1 if cur[1]=="R": cu...
s386985356
p03638
u263830634
1569597385
Python
Python (3.4.3)
py
Runtime Error
30
3956
1686
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) graph = [[-1] * W for _ in range(H)] h, w = 0, 0 #現在地 if H == W == 1: print (1) exit() #動ける範囲 right = W - 1 left = 0 up = 0 down = H - 1 tmp = 0 count = 1 flag = True while count <= H * W: if right == left == W //2 or ...
s734633539
p03638
u263830634
1569597327
Python
Python (3.4.3)
py
Runtime Error
30
3956
1645
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) graph = [[-1] * W for _ in range(H)] h, w = 0, 0 #現在地 if H == W == 1: print (1) exit() #動ける範囲 right = W - 1 left = 0 up = 0 down = H - 1 tmp = 0 count = 1 flag = True while count <= H * W: if right == left == W //2: ...
s504013369
p03638
u263830634
1569596334
Python
Python (3.4.3)
py
Runtime Error
30
3956
1585
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) graph = [[-1] * W for _ in range(H)] h, w = 0, 0 #現在地 #動ける範囲 right = W - 1 left = 0 up = 0 down = H - 1 tmp = 0 count = 1 flag = True while count <= H * W: if right == left: right += 1 if up == down: down +=...
s886182939
p03638
u263830634
1569596231
Python
Python (3.4.3)
py
Runtime Error
31
4080
1711
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) # if H == W == 1: # print (1) # exit() graph = [[-1] * W for _ in range(H)] h, w = 0, 0 #現在地 #動ける範囲 right = W - 1 left = 0 up = 0 down = H - 1 tmp = 0 count = 1 flag = True while count <= H * W: if right == left: ...
s349885197
p03638
u731368968
1569281897
Python
Python (3.4.3)
py
Runtime Error
54
4724
480
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) ans = [[0 for x in range(w)] for y in range(h)] def getx(i): return i // h def gety(i): return i % h if i // (2 * h) < h else h - (i % h) aa=[] for i in range(n): aa += [i + 1 for _ in range(a[i])] for i in range(h * w)...
s309577850
p03638
u668705838
1568386667
Python
Python (3.4.3)
py
Runtime Error
188
13296
290
h,w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) import numpy as np c = [0]*(h*w) idx = 0 for i in a: for j in range(i): c[idx] = i idx += 1 c = np.reshape(c,(w,h)) for i in range(h): if i%2: print(*c[i][::-1]) else: print(*c[i])
s368577382
p03638
u787456042
1568206753
Python
Python (3.4.3)
py
Runtime Error
30
3912
462
H,W,N,*A=map(int,open(0).read().split()) G=[[0]*W for _ in range(H)];h=0;w=0;f=0 for i,a in enumerate(A,1): if f: if W<w+a: G[h][:-w]=[i]*(W-w);a-=W-w for j in range(a//W): h+=1;G[h]=[i]*W a-=a//W*W;h+=1;G[h][:a]=[i]*a;f^=1;w=a else:G[h][-w-a:-w]=[i]*a;w+=a else: if W<w+a: G[h][w:]=[i]*(W-w);a-=...
s864477105
p03638
u123756661
1568090174
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38516
229
h,w=map(int,input().split()) n=int(input()) a=[int(i) for i in input().split()] s="" for i in range(n): s+=str(i+1)*a[i] for i in range(h): if i%2=0: print(*list(s[i*w:i*w+w])) else: print(*list(s[i*w:i*w+w][::-1]))
s628456776
p03638
u123756661
1568086414
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38384
365
import numpy as np H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) hw = [] for i, ai in enumerate(a): for j in range(ai): hw.append(i+1) hw = np.asarray(hw) HW = np.reshape(hw, (H, W)) for i in range(H): # print(*HW[i]) if i % 2 == 1: print(*...
s763974514
p03638
u423585790
1566795865
Python
PyPy3 (2.4.0)
py
Runtime Error
210
40816
2477
#!usr/bin/env python3 from collections import defaultdict from collections import deque from heapq import heappush, heappop import sys import math import bisect import random import itertools sys.setrecursionlimit(10**5) stdin = sys.stdin def LI(): return list(map(int, stdin.readline().split())) def LF(): return list(m...
s263942032
p03638
u562935282
1563942967
Python
Python (3.4.3)
py
Runtime Error
27
3572
480
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) a = [None] + a ans = [[None] * w for _ in range(h)] cur = 1 way = 1 r, c = 0, 0 flg = True while cur <= n: ans[r][c] = cur a[cur] -= 1 if a[cur] == 0: cur += 1 if (c == 0 or c == w - 1) and (not flg): ...
s259208899
p03638
u562935282
1563942658
Python
Python (3.4.3)
py
Runtime Error
30
3828
461
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) a = [None] + a ans = [[None] * w for _ in range(h)] cur = 1 way = 1 r, c = 0, 0 flg = True while cur <= n: ans[r][c] = cur a[cur] -= 1 if a[cur] == 0: cur += 1 if (c == 0 or c == w - 1) and (not flg): ...
s804169463
p03638
u927534107
1563921648
Python
Python (3.4.3)
py
Runtime Error
2141
618072
434
h,w=map(int,input().split()) n=int(input()) l=list(map(int,input().split())) l1=[] l2=[] ans=[[0]*w for _ in range(h)] for i in range(n): for j in range(i+1): l1.append(i+1) flag=1 for i in range(h): for j in range(w): if flag==1: l2.append([i,j]) else: l2.append(...
s000069070
p03638
u927534107
1563921491
Python
Python (3.4.3)
py
Runtime Error
2111
118872
434
h,w=map(int,input().split()) n=int(input()) l=list(map(int,input().split())) l1=[] l2=[] ans=[[0]*w for _ in range(h)] for i in range(n): for j in range(i+1): l1.append(l[i]) flag=1 for i in range(h): for j in range(w): if flag==1: l2.append([i,j]) else: l2.append...
s344976145
p03638
u360116509
1562001651
Python
Python (3.4.3)
py
Runtime Error
17
3064
461
def main(): _ = int(input()) A = list(map(int, input().split())) b1 = 0 b2 = 0 b4 = 0 for a in A: if a == 2: b2 += 1 continue if a // 2 > 1 and a % 2 == 0: b4 += 1 continue b1 += 1 if b2 > 0: if b4 >= b1: ...
s455426967
p03638
u497596438
1560907843
Python
PyPy3 (2.4.0)
py
Runtime Error
197
41968
570
H,W=map(int,input().split()) N=int(input()) A=list(map(int,input().split())) G=[[0]*W for i in range(H)] i=0 j=0 tmp=0 t=1 for a in A: tmp+=1 for k in range(a): G[i][j]=tmp if j==W-1: if t==0: i+=1 t=1 dx=0 elif t==1: ...
s965379603
p03638
u543954314
1559661935
Python
Python (3.4.3)
py
Runtime Error
23
3440
257
h,w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) s = [] l = [] for x in range(n): s += [x+1]*a[x+1] for i in range(h): l.append(s[w*i:w*(i+1)]) if i%2: l[i] = l[i][::-1] for x in l: print(" ".join(map(str,x)))
s467566881
p03638
u365364616
1554407861
Python
Python (3.4.3)
py
Runtime Error
32
3920
484
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) X = [[0 for j in range(w)] for i in range(h)] xi = -1 hi = 0 for i, ai in enumerate(a): for j in range(xi + 1, min(xi + ai + 1, w)): X[hi][j] = i + 1 if j == w - 1: hi += 1 j = -1 for j in rang...
s555698492
p03638
u365364616
1554407660
Python
Python (3.4.3)
py
Runtime Error
32
3920
484
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) X = [[0 for j in range(w)] for i in range(h)] xi = -1 hi = 0 for i, ai in enumerate(a): for j in range(xi + 1, min(xi + ai + 1, w)): X[hi][j] = i + 1 if j == w - 1: hi += 1 j = -1 for j in rang...
s218274519
p03638
u647213752
1551057779
Python
Python (3.4.3)
py
Runtime Error
35
3920
529
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) l = list() for i, num in enumerate(a): l += [i+1]*num for i in range(H): if i % 2 == 0: for j in range(W): if j == W-1: print(l[i*H + j], end='') else: print(...
s476000910
p03638
u647213752
1551057719
Python
Python (3.4.3)
py
Runtime Error
37
3956
539
H, W = map(int, input().split()) N = int(input()) a = list(map(int, input().split())) l = list() for i, num in enumerate(a): l += [i+1]*num print(l) for i in range(H): if i % 2 == 0: for j in range(W): if j == W-1: print(l[i*H + j], end='') else: ...
s330565021
p03638
u647213752
1551057553
Python
Python (3.4.3)
py
Runtime Error
18
3064
535
H, W = map(int, input().split) N = int(input()) a = list(map(int, input().split)) l = list() for i, num in enumerate(a): l += [i+1]*num print(l) for i in range(H): if i % 2 == 0: for j in range(W): if j == W-1: print(l[i*H + j], end='') else: ...
s273816147
p03638
u647213752
1551057393
Python
Python (3.4.3)
py
Runtime Error
18
3064
504
N = int(input()) a = list(map(int, input().split)) l = list() for i, num in enumerate(a): l += [i+1]*num print(l) for i in range(H): if i % 2 == 0: for j in range(W): if j == W-1: print(l[i*H + j], end='') else: print(l[i*H + j], end=' ') ...
s592616174
p03638
u730205408
1551057243
Python
Python (3.4.3)
py
Runtime Error
17
3064
345
H,W = map(int,input().split()) N = int(input()) a = map(int,input().split()) c = [0]*len(a) n = 0 sign = 1 for h in range(H): state = [0]*W for w in range(W): if c[n]>=a[n]: n += 1 state[w] = str(n+1) c[n] += 1 sign = (sign+1)%2 if sign: state = state[::-1] ...
s629730322
p03638
u730205408
1551057116
Python
Python (3.4.3)
py
Runtime Error
18
3064
328
H,W = map(int,input().split()) a = map(int,input().split()) c = [0]*len(a) n = 0 sign = 1 for h in range(H): state = [0]*W for w in range(W): if c[n]>=a[n]: n += 1 state[w] = str(n+1) c[n] += 1 sign = (sign+1)%2 if sign: state = state[::-1] print(' '.join...
s593884528
p03638
u647213752
1551057042
Python
Python (3.4.3)
py
Runtime Error
17
3064
351
H, W = map(int, input().split) N = int(input()) a = list(map(int, input().split)) l = list() for i, num in enumerate(a): l += [i+1]*num print(l) for i in range(H): if i % 2 == 0: for j in range(W): print(l[i*H + j], end=' ') else: for j in range(W): print(l[i*H +...
s077611321
p03638
u824237520
1541800732
Python
Python (3.4.3)
py
Runtime Error
18
3060
236
n = int(input()) a = list(map(int, input().split())) f = 0 d = 0 for x in a: if x % 4 == 0: f += 1 elif x % 2 == 0: d += 1 if 0 < d < n: d -= 1 if n > f * 2 + 1 + d: print('No') else: print('Yes')
s884542675
p03638
u177398299
1534358506
Python
Python (3.4.3)
py
Runtime Error
23
3444
235
H, W = map(int, input().split()) N = int(input()) # *A, = map(int, input().split()) A = list(map(int, input().split())) c = [] for i in range(N): c += [i + 1] * A[i] for i in range(H): print(*c[i * W: (i + 1) * W][::-(i % 2)])
s032983727
p03638
u729707098
1521855613
Python
Python (3.4.3)
py
Runtime Error
34
3316
357
h,w = (int(i) for i in input().split()) n = int(input()) a = [int(i) for i in input().split()] x,num = "",0 for i in range(n): x += str(i+1)*a[i] while x != "": num += 1 y = "" if num%2==1: for i in range(w-1): y += x[i]+" " y += x[w-1] print(y) x = x[w:] else: for i in range(w-1,0,-1): y += x[i]+"...
s762579460
p03638
u820351940
1520641207
Python
Python (3.4.3)
py
Runtime Error
26
3780
536
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) field = [0 for x in range(h * w)] now = 0 field[now] = 1 while True: for j in range(field[now]): now += 1 field[now] = field[now - 1] if now == h * w - 1: break if now == h * w - 1: ...
s981610530
p03638
u820351940
1520640209
Python
Python (3.4.3)
py
Runtime Error
20
3188
612
h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) # field[h][w]; field = [[0 for x in range(w)] for y in range(h)] field[0][0] = 1 now_y = 0 now_x = 0 back = False for j in range(h * w): for i in range(field[now_y][now_x]): if back: now_x -= 1 else: ...
s818544541
p03638
u898651494
1517796276
Python
Python (3.4.3)
py
Runtime Error
17
2940
1730
#include <iostream> #include <fstream> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <queue> #include <deque> #include <functional> using namespace std; using ll = long long; #define FOR(i, m, ...
s036204423
p03638
u047535298
1502569504
Python
Python (3.4.3)
py
Runtime Error
64
3700
969
if __name__ == '__main__': 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)] vx = [1, -1, 0, 0] vy = [0, 0, 1, -1] color = 0 def draw(x, y, num): sx, sy = x, y cnt = num queue = [(...
s196928901
p03638
u796424048
1502474406
Python
Python (3.4.3)
py
Runtime Error
17
2940
483
H,M = list(map(int,input().split())) N = int(input()) a = list(map(int,input().split()) fill_space = [] mass = [[0 for i in range(M)] for j in range(H)] count = 0 for i in range(N): for j in a[j]: fill_space.append(j+1) for k in range(H): for n in range(M): mass[k][n] = fill_space[count] ...
s321851397
p03638
u796424048
1502474290
Python
Python (3.4.3)
py
Runtime Error
17
2940
431
H,M = list(map(int,input().split())) N = int(input()) a = list(map(int,input().split()) fill_space = [] mass = [[0 for i in range(M)] for j in range(H)] count = 0 for i in range(N): for j in a[j]: fill_space.append(j+1) for k in range(H): for n in range(M): mass[k][n] = fill_space[count] ...
s147535170
p03638
u289381123
1502255374
Python
Python (2.7.6)
py
Runtime Error
209
3572
278
h,w=map(int,raw_input().split()) n=input() g=map(int,raw_input().split()) l=[] for i in range(n): l=l+[i+1]*g[i] for i in range(h): l1=[] for j in range(w): l1.append(l[h*i+j]) if i%2==1: l1.reverse() for j in l1: print j, print
s276879246
p03638
u289381123
1502246052
Python
Python (2.7.6)
py
Runtime Error
212
3612
357
h,w=map(int,raw_input().split()) n=input() g=map(int,raw_input().split()) l=[] for i in range(n): l=l+[i+1]*g[i] ans=[] for i in range(h): l1=[] for j in range(w): l1.append(l[h*i+j]) if i%2==0: ans=ans+[l1] elif i%2==1: l1.reverse() ans=ans+[l1] for i in ans: for...
s515740251
p03638
u258647915
1502220159
Python
Python (3.4.3)
py
Runtime Error
24
3188
290
def read(): return list(map(int, input().split())) h, w = read() n = int(input()) A = read() s = "" for i, a in enumerate(A): s += str(i + 1) * a assert len(s) == h * w for i in range(h): out = s[i * w: i * w + w] if i & 1: out = out[::-1] print(" ".join(out))
s118085757
p03638
u372345564
1502075660
Python
Python (3.4.3)
py
Runtime Error
408
21452
1066
import numpy as np def main(): H, W = [int(i) for i in input().split()] N = int(input()) a = [int(i) for i in input().split()] color_ar = np.zeros((H, W), dtype=np.int32) #print(color_ar) y = 0 x = 1 for i in range(N): t = a[i] while t > 0: if(...
s618024551
p03638
u372345564
1502075241
Python
Python (3.4.3)
py
Runtime Error
393
13696
1007
import numpy as np def main(): H, W = [int(i) for i in input().split()] N = int(input()) a = [int(i) for i in input().split()] color_ar = np.zeros((H, W), dtype=np.int32) #print(color_ar) y = 0 x = 1 for i in range(N): t = a[i] while t > 0: if(...
s400883256
p03638
u372345564
1502074678
Python
Python (3.4.3)
py
Runtime Error
401
21456
980
import numpy as np def main(): H, W = [int(i) for i in input().split()] N = int(input()) a = [int(i) for i in input().split()] color_ar = np.zeros((H, W), dtype=np.int32) #print(color_ar) y = 0 x = 1 for i in range(N): t = a[i] while t > 0: if(...
s377148256
p03638
u845674689
1502072725
Python
Python (3.4.3)
py
Runtime Error
44
4464
1268
def get_edge(arr): for i in range(len(arr)): for j in range(len(arr[i])): if arr[j][i] == 0: return j, i # Data preprocessing input_line_arr = input().split(' ') H = int(input_line_arr[0]) W = int(input_line_arr[1]) N = int(input()) input_line_arr = input().split...
s400224850
p03638
u845674689
1502072606
Python
Python (3.4.3)
py
Runtime Error
44
4592
1234
def get_edge(arr): for i in range(len(arr)): for j in range(len(arr[i])): if arr[j][i] == 0: return j, i # Data preprocessing input_line_arr = input().split(' ') H = int(input_line_arr[0]) W = int(input_line_arr[1]) N = int(input()) input_line_arr = input().split...
s100360704
p03638
u792547805
1502071684
Python
Python (3.4.3)
py
Runtime Error
37
3956
570
l = input().split() H = int(l[0]) W = int(l[1]) N = int(input()) c= [[0 for i in range(W)] for j in range(H)] color_num = [int(i) for i in input().split()] row = 0 column = 0 for i in range(N): index = color_num[i] for j in range(0, index): c[row][column] = i+1 if column % (W-1) == 0 and c...
s401808740
p03638
u315857144
1502071031
Python
Python (3.4.3)
py
Runtime Error
45
3444
398
n, m = [int(x) for x in input().split()] tmp = input().split() arr = [int(x) for x in input().split()] s = "" for i in range(len(arr)): s += str(i + 1) * arr[i] n_s = "" r = 0 for i in range(len(s)): if i % m == 0: r+=1 if r != 1: n_s += "\n" if r % 2 == 1: n_s += s[i] + ...
s472530824
p03639
u999503965
1599769989
Python
Python (3.8.2)
py
Runtime Error
65
20288
276
import math n=int(input()) l=list(map(int,input().split())) c_4=0 c_2=0 for i in l: if i%4==0: c_4+=1 elif i%2==0: c_2+=1 if c_2==1: num=n else: num=n-c_2 if matj.ceil(num/2) <= c_4: ans="Yes" elif c_2==n: ans="Yes" else: ans="No" print(ans)
s867255548
p03639
u168416324
1598284804
Python
Python (3.8.2)
py
Runtime Error
48
20012
161
n=int(input()) lis=list(map(int,input().split())) t,f=0 for i in lis: if i%2==0: t+=2 if i%4==0: f+=2 if t+f>=n: print("Yes") else: print("No")
s846436619
p03639
u674588203
1597438828
Python
Python (3.8.2)
py
Runtime Error
25
8840
650
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") exit() else: ...
s682296774
p03639
u674588203
1597438272
Python
Python (3.8.2)
py
Runtime Error
66
20028
997
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") exit() else: ...
s883461389
p03639
u674588203
1597431624
Python
Python (3.8.2)
py
Runtime Error
64
19964
674
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") exit() else: ...
s919349634
p03639
u674588203
1597431510
Python
Python (3.8.2)
py
Runtime Error
28
8844
1148
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: i...
s200249968
p03639
u674588203
1597430676
Python
Python (3.8.2)
py
Runtime Error
64
19984
763
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") exit() else: ...
s838824896
p03639
u674588203
1597430573
Python
Python (3.8.2)
py
Runtime Error
65
20136
673
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") else: print("No") i...
s484886189
p03639
u674588203
1597430512
Python
Python (3.8.2)
py
Runtime Error
64
20128
580
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") else: print("No") i...
s015738404
p03639
u674588203
1597430143
Python
Python (3.8.2)
py
Runtime Error
62
19980
652
# AtCoder Regular Contest 080 # C - 4-adjacent N=int(input()) alist=list(map(int,input().split())) oddcount=0 mod40=0 other=0 for a in alist: if a%2==1: oddcount+=1 elif a%4==0: mod40+=1 else: other+=1 if N==1: if mod40==N: print("Yes") else: print("No") i...
s805044134
p03639
u131464432
1596153094
Python
Python (3.8.2)
py
Runtime Error
26
9032
282
N = int(input()) a = list(map(int,input().split())) zero,one,two = 0,0,0 for i in a: if i%4 == 0: two += 1 elif i%2 == 0: one += 1 else: zero += 1 if one = N: print("Yes") exit() print("Yes" if two+int(two>0) >= zero+int(one>0) else "No")
s783144384
p03639
u640922335
1595004225
Python
Python (3.8.2)
py
Runtime Error
23
9008
294
N=int(input()) A=list(map(int,input().split())) a=0 b=0 for num in A: if num%2==1: a+=1 elif num%4==0: b+=1 if N==3: if a==3 or (a>=1 and b==0): print('No') else: print('Yes') else: if a=<b: print('Yes') else: print('No')
s136184415
p03639
u131881594
1592335662
Python
Python (3.4.3)
py
Runtime Error
17
3064
429
h,w=map(int,input().split()) n=int(input()) a=list(map(int,input().split())) colors=[] for i in range(n): for _ in range(a[i]): colors.append(i+1) 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-j-1 ans[i][j]=colors[...
s091486243
p03639
u131881594
1592334119
Python
Python (3.4.3)
py
Runtime Error
18
3064
258
n = int(input) a=list(map(int,input().split())) cnt,cnt2,cnt4=0,0,0 for val in a: if val%4==0: cnt4+=1 elif val%2==0: cnt2+=1 else: cnt+=1 if cnt2==n: print("Yes") else: if cnt4>=cnt: print("Yes") else: print("No")
s142039187
p03639
u545368057
1591806655
Python
Python (3.4.3)
py
Runtime Error
17
2940
473
n = int(input()) As = list(map(int, input().split())) # four = sum([1 for a in As if a%4 == 0]) # odd = sum([1 for a in As if a%2 == 1]) # two = sum([1 for a in As if a%2 == 0 and a%4 != 0]) four = 0 odd = 0 two = 0 for a in As: if a % 2 == 1: odd += 1 elif a % 4 == 0: four += 1 else: ...
s405068405
p03639
u742729271
1590719397
Python
Python (3.4.3)
py
Runtime Error
41
14252
205
N = int(input()) a = list(map(int, input().split())) c2=c4=0 for i in range(len(N)): if a[i]%4==0: c4+=1 if a[i]%2==0: c2+=1 nodd=N-c2 c4=c4-c2 if nodd<c4: print("Yes") else: print("No")
s712060016
p03639
u337626942
1590255352
Python
Python (3.4.3)
py
Runtime Error
17
2940
350
n=int(input()) a=list(map(int, input().split())) cnt_2=0 cnt_1=0 cnt_0=0 for num in a: if num%4==0: cnt_2+=1 elif num%2==0: cnt_1+=1 else: cnt_0+=1 if cnt_1=0: if cnt_2+1>=cnt_0: print("Yes") else: print("No") else: if cnt_2>=cnt_0: print("Yes")...
s617269177
p03639
u888092736
1588950187
Python
Python (3.4.3)
py
Runtime Error
80
12872
303
N = int(input()) counter = {} for a in map(int, input().split()): if a % 4 == 0: counter[2] = counter.get(2, 0) + 1 elif a % 2 == 0: counter[1] = counter.get(1, 0) + 1 else: counter[0] = counter.get(0, 0) + 1 print('Yes') if counter[0] <= counter[2] else print('No')
s590339416
p03639
u485716382
1587442073
Python
PyPy3 (2.4.0)
py
Runtime Error
224
58324
389
def main(): N = int(input()) an = sorted(map(int, input().split(' '))) # N = 6 # an = [2, 7, 1, 8, 2, 8] # an = [1, 2, 3, 4] # a = [i % 4 for i in an] for i in range(len(N)-1): a = an[i] b = an[i+1] c = a * b if c % 4 != 0: print('No...
s919462204
p03639
u057993957
1586668304
Python
Python (3.4.3)
py
Runtime Error
186
23120
282
import numpy as np n = int(input()) a = np.array(list(map(int, input().split()))) a4 = len(a[a % 4 == 0]) a2 = len(a[a % 2 == 0 and a % 4 != 0]) a4n = len(a[a % 4 != 0]) - a2 if a2 != 0: print("Yes" if a4 + 1 >= a4n+1 else "No") else: print("Yes" if a4 + 1 >= a4n else "No")