-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask263.py
More file actions
17 lines (15 loc) · 1.4 KB
/
Copy pathtask263.py
File metadata and controls
17 lines (15 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# best: 106(Code Golf International) / others: 112(jailctf merger), 112(biz), 115(HIMAGINE THE FUTURE.), 117(ox jam), 119(lv1.dev)
# ================================================= 106 ==================================================
# lambda g:len(g)>3and(f:=sorted([(sum(t:=g[i:i+3],g[0]).count(0),t)for i in range(0,len(g),3)]))[-(f[0][0]==f[1][0])][1]or[*zip(*p([*zip(*g)]))]
# lambda g:len(g)>3and(f:=sorted([(str(t:=g[i:i+3]).count("0"),t)for i in range(0,len(g),3)]))[-(f[0][0]==f[1][0])][1]or[*zip(*p([*zip(*g)]))]
# lambda g:len(g)>3and(f:=sorted(zip(*[iter(g)]*3),key=(h:=lambda t:str(t).count("0"))))[-(h(f[0])==h(f[1]))][1]or[*zip(*p([*zip(*g)]))]
# lambda g,c=1:g*-c or(f:=sorted((str(t).count("0"),t)for t in zip(*[iter(zip(*p([*zip(*g)],c-1)))]*3))*2)[-(f[0][0]==f[1][0])][1]
# p=lambda g:len(g)>3and(f:=sorted((str(t).count("0"),t)for t in zip(*[iter(g)]*3)))[-(f[0][0]==f[1][0])][1]or[*zip(*p([*zip(*g)]))]
# p=lambda g,c=-1:c*g or[*zip(*(f:=sorted((str(t).count("0"),t)for t in zip(*[iter(p(g,c+1))]*3)))[-(f[0][0]==(f*2)[1][0])][1])]
p=lambda g,c=-1:c*g or(f:=sorted((str(t).count("0"),t)for t in zip(*[zip(*p(g,c+1))]*3))*2)[-(f[0][0]==f[1][0])][1]
# def p(g):
# if len(g)<4:
# return[*zip(*p([*zip(*g)]))]
# # f=sorted([((g[i]+g[i+1]+g[i+2]).count(0),g[i:i+3])for i in range(0,len(g),3)])
# f=sorted([(sum(t:=g[i:i+3],g[0]).count(0),t)for i in range(0,len(g),3)])
# return f[-(f[0][0]==f[1][0])][1]