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
s759129861
p03747
u684695949
1559183215
Python
Python (3.4.3)
py
Runtime Error
18
3064
1716
import bisect N,L,T= map(int,input().split()) ants = [[],[]] for i in range(N): X,W = map(int,input().split()) ants[W-1].append(X) if len(ants[0]) == N: for i in range(N): print(((x+T)%L)) exit() if len(ants[0]) == 0: for i in range(N): print(((x-T)%L)) exit() ants_final_pos = sorted([((x+T)%L) for x in ...
s139825039
p03747
u684695949
1559183132
Python
PyPy3 (2.4.0)
py
Runtime Error
164
38384
1716
import bisect N,L,T= map(int,input().split()) ants = [[],[]] for i in range(N): X,W = map(int,input().split()) ants[W-1].append(X) if len(ants[0]) == N: for i in range(N): print(((x+T)%L)) exit() if len(ants[0]) == 0: for i in range(N): print(((x-T)%L)) exit() ants_final_pos = sorted([((x+T)%L) for x in ...
s758218715
p03747
u684695949
1559183110
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38384
1746
import bisect N,L,T= map(int,input().split()) mod_within = lambda x: x % L ants = [[],[]] for i in range(N): X,W = map(int,input().split()) ants[W-1].append(X) if len(ants[0]) == N: for i in range(N): print(((x+T)%L)) exit() if len(ants[0]) == 0: for i in range(N): print(((x-T)%L)) exit() ants_final_pos...
s559133526
p03747
u684695949
1559182909
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38256
1788
import bisect N,L,T= map(int,input().split()) mod_within = lambda x: x % L ants = [[],[]] for i in range(N): X,W = map(int,input().split()) ants[W-1].append(X) if len(ants[0]) == N: for i in range(N): print(mod_within(x+T)) exit() if len(ants[0]) == 0: for i in range(N): print(mod_within(x-T)) exit() an...
s297780004
p03747
u182047166
1558467077
Python
Python (3.4.3)
py
Runtime Error
2104
15320
3106
import bisect import sys def input(): return sys.stdin.readline()[:-1] # N = int(input()) # A = [int(x) for x in input().split()] # a, b, c = map(int, input().split()) # name1 = str(input()) # alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5} # b = list(map(lambda x: math.ceil(x/10)*10, a)) n, l, t = map(int, in...
s274496253
p03747
u260216890
1557161760
Python
Python (3.4.3)
py
Runtime Error
457
13648
615
n, l, t = map(int,input().split()) x=[] w=[] for i in range(n): x_temp, w_temp=map(int, input().split()) x.append(x_temp) w.append(w_temp) final_x=[] for i in range(n): if w[i]==1: final_x.append((x[i]+t)%l) elif w[i]==2: final_x.append((x[i]-t)%l) new_x=sorted(final_x) cnt=0 if w[0]...
s507044755
p03747
u260216890
1557160683
Python
Python (3.4.3)
py
Runtime Error
453
12892
569
n, l, t = map(int,input().split()) x=[] w=[] for i in range(n): x_temp, w_temp=map(int, input().split()) x.append(x_temp) w.append(w_temp) final_x=[] for i in range(n): if w[i]==1: final_x.append((x[i]+t)%l) elif w[i]==2: final_x.append((x[i]-t)%l) cnt=0 if w[0]==2: for i in rang...
s505475854
p03747
u909643606
1548547650
Python
Python (3.4.3)
py
Runtime Error
472
24240
3400
#import sys #input = sys.stdin.readline #template input import bisect def IT(): #整数1個 return int(input()) def IL(): #整数複数 return [int(_) for _ in input().split()] def IS(): #文字列複数 return [_ for _ in input().split()] def ILS(n): #整数1つ 縦にズラーってなってるやつ return [int(input()) for _ in range(n)] def SLS(n): #文字...
s138648501
p03747
u941407962
1539218650
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38256
210
n,l,t=map(int,input().split()) a,cs=[0]*n,0 for i in range(n): x,y=map(int,input().split()) x+=(t if y==1 else -t) cs=(cs+x//l)%n x%=l a[i]=x a.sort() print('\n'.join([str(a[(i+cs)%n]) fori in range(n)]))
s270421947
p03747
u941407962
1539216151
Python
PyPy3 (2.4.0)
py
Runtime Error
361
59612
1370
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) # if (x + (1 if y == 1 else -1) * T)%L == 52648: # pri...
s191730158
p03747
u941407962
1539216091
Python
PyPy3 (2.4.0)
py
Runtime Error
354
59612
1381
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) # if (x + (1 if y == 1 else -1) * T)%L == 52648: # pri...
s073526084
p03747
u941407962
1539212488
Python
PyPy3 (2.4.0)
py
Runtime Error
354
59612
1282
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s893604322
p03747
u941407962
1539212195
Python
PyPy3 (2.4.0)
py
Runtime Error
363
59612
1208
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s885862843
p03747
u941407962
1539212167
Python
PyPy3 (2.4.0)
py
Runtime Error
357
59612
1219
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s802771651
p03747
u941407962
1539203894
Python
PyPy3 (2.4.0)
py
Runtime Error
356
58588
1175
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s130693114
p03747
u941407962
1539203016
Python
PyPy3 (2.4.0)
py
Runtime Error
355
58844
1192
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s515811768
p03747
u941407962
1539201779
Python
PyPy3 (2.4.0)
py
Runtime Error
352
58588
1122
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s805023290
p03747
u941407962
1539201725
Python
PyPy3 (2.4.0)
py
Runtime Error
349
58716
1132
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s362818707
p03747
u941407962
1539201107
Python
PyPy3 (2.4.0)
py
Runtime Error
351
58588
1137
import sys N, L, T = [int(x) for x in input().strip().split(" ")] xys = [] candidates = [] for line in sys.stdin: x, y = line.strip().split(" ") x, y = int(x), int(y) xys.append((x,y)) candidates.append((x + (1 if y == 1 else -1) * T)%L) x0, y0 = xys[0] dxs = [] pr_x = None counter = 0 for x, y in x...
s206956554
p03747
u536113865
1536991555
Python
Python (3.4.3)
py
Runtime Error
445
17040
1317
li = lambda: list(map(int,input().split())) n,l,t = li() a,ac,au = [],[],[] for i in range(n): x,y = li() if i == 0: start = y a.append(x) if y == 1: ac.append(x) else: au.append(x) tt = t%l if not ac: pointofone = (au[0]-t) % l elif not au: pointofone = (ac[0]+t) % l elif ...
s782093064
p03747
u536113865
1536990576
Python
Python (3.4.3)
py
Runtime Error
415
16672
1196
li = lambda: list(map(int,input().split())) n,l,t = li() a,ac,au = [],[],[] for i in range(n): x,y = li() if i == 0: start = y a.append(x) if y == 1: ac.append(x) else: au.append(x) tt = t%l if start == 2: acc = [n-ac[-s] for s in range(1,len(ac)+1)] dist = au[0]+acc[0] ...
s755580240
p03747
u536113865
1536990244
Python
Python (3.4.3)
py
Runtime Error
433
16704
1199
li = lambda: list(map(int,input().split())) n,l,t = li() a,ac,au = [],[],[] for i in range(n): x,y = li() if i == 0: start = y a.append(x) if y == 1: ac.append(x) else: au.append(x) tt = t%l if start == 2: acc = [n-ac[-s] for s in range(1,len(ac)+1)] dist = au[0]+acc[0] ...
s524228732
p03747
u997521090
1534651491
Python
Python (2.7.6)
py
Runtime Error
559
32596
1355
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(10000000) N, L, T = map(int, raw_input().split()) T %= L X1 = [] X2 = [] Xs = [] for i in range(N): X, W = map(int, raw_input().split()) if W == 1: X1.append(X) else: ...
s457800819
p03747
u562016607
1532977610
Python
Python (3.4.3)
py
Runtime Error
521
13424
726
N,L,T=map(int,input().split()) X=[0 for i in range(N)] W=[0 for i in range(N)] for i in range(N): X[i],W[i]=map(int,input().split()) Y=[0 for i in range(N)] for i in range(N): if W[i]==1: Y[i]=(X[i]+T)%L else: Y[i]=(X[i]-T)%L def dist(i,j): if (3-2*W[i])*(3-2*W[j])==1: return -1 ...
s677348100
p03747
u817026203
1524956155
Python
PyPy3 (2.4.0)
py
Runtime Error
959
87896
1051
def main(): n, l, t = map(int, input().split()) xs, ds = [], [] for _ in range(n): x, w = [int(c) for c in input().split()] xs.append(x) ds.append(1 if w == 1 else -1) xs_thr = [(x + d * t )% l for x, d in zip(xs, ds)] x_groups = { -1: [x for i, x in enumerate(xs) i...
s627340752
p03747
u061545295
1523007114
Python
Python (3.4.3)
py
Runtime Error
2105
25164
1904
# AtCoder Grand Contest 013 #■標準入力ショートカット def get_next_int(): return int(float(input())) def get_next_ints(delim=" "): return tuple([int(float(x)) for x in input().split(delim)]) def get_next_str(): return input() def get_next_strs(delim=" "): return tuple(input().split(delim)) def get_next_b...
s238487921
p03747
u061545295
1523006906
Python
Python (3.4.3)
py
Runtime Error
2105
39684
1971
#■標準入力ショートカット def get_next_int(): return int(float(input())) def get_next_ints(delim=" "): return tuple([int(float(x)) for x in input().split(delim)]) def get_next_str(): return input() def get_next_strs(delim=" "): return tuple(input().split(delim)) def get_next_by_types(*value_types, delim="...
s229389214
p03747
u602860891
1493240414
Python
Python (3.4.3)
py
Runtime Error
649
47996
1229
N, L, T = list(map(int, input().split())) X = [] W = [] X_after = [] for _ in range(N): x, w = list(map(int, input().split())) if w == 1: x_after = (x + T) % L else: x_after = (x - T) % L if x_after < 0: x_after = L + x_after X.append(x) W.append(w) X_after.append(...
s465447206
p03747
u602860891
1493239403
Python
Python (3.4.3)
py
Runtime Error
615
47352
1107
N, L, T = list(map(int, input().split())) X = [] W = [] X_after = [] for _ in range(N): x, w = list(map(int, input().split())) if w == 1: x_after = (x + T) % L else: x_after = (x - T) % L if x_after < 0: x_after = L + x_after X.append(x) W.append(w) X_after.append(...
s940152051
p03747
u985443069
1492427612
Python
Python (3.4.3)
py
Runtime Error
18
3192
2077
import sys sys.stdin = open('c2.in') # sys.stdin = open('gen_c/c10.in') def solve_it_large(n, l, t, x, w): ants = [] for i in range(n): ants.append([x[i], w[i], (x[i] + w[i] * t) % l, i]) # ants.sort() n_intersections = 0 x0, w0, dest0, i0 = ants[0] for x, w, dest, i in ants: ...
s376205139
p03747
u054556734
1492344762
Python
Python (3.4.3)
py
Runtime Error
17
2940
1176
# アリ1からNまでの前後関係は不変。つまり、アリ1からNまでの順番は保たれる。 # アリの最終座標の昇順リストを用意して、アリ1からNに対応させればよい。 n,l,t=map(int,input().split()) x=[0 for i in range(n+1)] w=[0 for i in range(n+1)] ans=[] # アリの最終座標リスト w1=[] # w=1のアリの初期座標リスト w2=[] # w=2のアリの初期座標リスト for i in range(1,n+1): x[i],w[i]=map(int,input().split()) if w[i]==1: a=(x[i]+t)%...
s636786001
p03747
u854685751
1492322771
Python
Python (3.4.3)
py
Runtime Error
385
8992
1044
N, L, T = list(map(int, input().split(" "))) # N,L,T = 3,10,6 # a = [1,2,3] # b = [2,1,1] a = [] b = [] for i in range(N): an, ve = map(int, input().split(" ")) a.append(an) b.append(ve) crash = 0 for i in range(1, N): if b[0] != b[i]: if b[0] == 1: crash += (T - ((a[i] - a[0]) /...
s116297801
p03747
u466826467
1492313295
Python
Python (3.4.3)
py
Runtime Error
404
29084
1134
# N:ありの頭数 L:周の長さ T:時間。この時の状態を求める N, L, T = list(map(int, input().split())) ant = [list(map(int, input().split())) for i in range(N)] line_pos = [] for i in range(0, N): if ant[i][1] == 1: line_pos.append(ant[i][0] + T) else: line_pos.append(ant[i][0] - T) # X1についてのみみる if ant[0][1] == 1: cr...
s978973397
p03747
u238510421
1492312808
Python
Python (3.4.3)
py
Runtime Error
2109
26844
1669
import numpy as np from numpy import inf n,l,t = list(map(int,input().split())) x_list = list() w_list = list() for i in range(n): x, w = list(map(int,input().split())) x_list.append(x) w_list.append(w) d_list = list() for i in range(len(x_list)-1): d_list.append(x_list[i+1]-x_list[i]) d_list.append(x...
s328228617
p03747
u945080461
1492310443
Python
Python (2.7.6)
py
Runtime Error
179
21900
1042
from sys import stdin from itertools import repeat def main(): n, l, t = map(int, stdin.readline().split()) dat = map(int, stdin.read().split(), repeat(10, 2 * n)) for i in xrange(1, n * 2, 2): if dat[i] == 2: dat[i] = -1 t %= l y = [(dat[i*2] + t * dat[i*2+1]) % l for i in xrang...
s709392829
p03747
u945080461
1492310303
Python
Python (2.7.6)
py
Runtime Error
181
21904
1021
from sys import stdin from itertools import repeat def main(): n, l, t = map(int, stdin.readline().split()) dat = map(int, stdin.read().split(), repeat(10, 2 * n)) for i in xrange(1, n * 2, 2): if dat[i] == 2: dat[i] = -1 t %= l y = [(dat[i*2] + t * dat[i*2+1]) % l for i in xrang...
s373856368
p03747
u556160473
1492309510
Python
Python (3.4.3)
py
Runtime Error
2112
1107908
542
import numpy as np n,l,t = map(int, input().split(' ')) x,w = [],[] x1,x2 = [],[] for _ in range(n): x_,w_ = map(int, input().split(' ')) x.append(x_) w.append(w_) if w_ == 1: x1.append(x_) elif w_ == 2: x2.append(x_) x_ = np.array(x) w_ = np.array(w) final_x = (x_+(-w_*2+3)*t)%l ...
s035548919
p03747
u556160473
1492309354
Python
Python (3.4.3)
py
Runtime Error
2112
1110340
549
import numpy as np n,l,t = map(int, input().split(' ')) x,w = [],[] x1,x2 = [],[] for _ in range(n): x_,w_ = map(int, input().split(' ')) x.append(x_) w.append(w_) if w_ == 1: x1.append(x_) elif w_ == 2: x2.append(x_) x_ = np.array(x) w_ = np.array(w) final_x = (x_+(-w_*2+3)*t)%l ...
s092688272
p03747
u602860891
1492308616
Python
Python (3.4.3)
py
Runtime Error
17
3064
1312
ant_list = [] # (pos, direction) N, L, T = list(map(int, input().split())) for i in range(N): pos, direction = list(map(int, input().split())) ant_list.append(Ant(pos, direction)) for t in range(T): clide_ant_list = get_colide_ants(ant_list) for ant in colide_ant_list: ant.change_direction(...
s424473885
p03751
u312666261
1591571568
Python
Python (3.4.3)
py
Runtime Error
17
3064
399
n, k = map(int, input().split()) a = list(map(int, input().split())) min_cost = float("inf") for i in range(2**n): if bin(i).count("1") != k: continue min_h = a[0] cost = 0 for j in range(1, n): if i >> j & 1: min_h += 1 cost += max(0, min_h-a[j]) ...
s532943686
p03751
u033602950
1589352068
Python
Python (3.4.3)
py
Runtime Error
18
3060
386
n,k = list(map(int, input().split())) a=list(map(int, input().split())) ans=[] for i in range(1<<n): if bin(i).count("1")==k: cst=0 use=a.copy() for u in range(1,n): if(i>>u&1): left_max=max(use[:u]) cst+=left_max-use[u]+1 ...
s108587312
p03751
u579699847
1588359904
Python
Python (3.4.3)
py
Runtime Error
17
3064
497
def LI(): return list(map(int,input().split())) N,K = LI() a = LI() ans = float('INF') for i in range(2**(N-1)): bit = [i>>j&1 for j in range(N-1)] if K-1!=sum(bit): continue cost,kijun = 0,a[0] for k in range(N-1): if bit[k]==0: kijun = max(kijun,a[k+1]) else: ...
s658515322
p03751
u487523716
1587319782
Python
Python (3.4.3)
py
Runtime Error
19
3444
4883
#recursion-version #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 import sys sys.setrecursionlimit(10000) inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 4 1 2 2 3 2 4 '''[1:] input2 =''' 4 1 2 2 4...
s118126665
p03751
u143509139
1575690511
Python
Python (3.4.3)
py
Runtime Error
45
4852
279
n=int(input()) s = [input()for _ in range(n)] t = input() s += t a = s.copy() z = s.copy() for i in range(n): a[i] = a[i].replace('?', 'a') z[i] = z[i].replace('?', 'z') a.sort() z.sort() idx1 = z.index(t) idx2 = a.index(t) print(' '.join(map(str,range(idx1 + 1, idx2 + 2))))
s091246140
p03752
u935685410
1600295861
Python
Python (3.8.2)
py
Runtime Error
87
9284
2192
import copy N,K = map(int,input().split()) A_list = list(map(int,input().split())) ########### can_see = [0] max_building = A_list[0] for i in range(0,N-1): if max_building < A_list[i+1]: can_see.append(i+1) max_building = A_list[i+1] #print("can_see",can_see) need_to_build = K-len(can_see) #print("NTB",...
s520224261
p03752
u771383254
1600202608
Python
Python (3.8.2)
py
Runtime Error
66
9128
410
n, k = map(int, input().split()) a = list(map(int, input().split())) ans = float('inf') for bit in range(1<<(n-1)): cand = [0]*(n-1) for i in range(n-1): if bit & 1<<i: cand[i] = 1 if cand.count(1) != k-1: continue cost = 0 mx = a[0] for i in range(1, n): if cand[i-1]: if a[i] <= mx: ...
s314691534
p03752
u771383254
1600202125
Python
Python (3.8.2)
py
Runtime Error
63
9228
412
n, k = map(int, input().split()) a = list(map(int, input().split())) ans = float('inf') for bit in range(1<<(n-1)): cost = 0 cand = [0]*(n-1) for i in range(n-1): if bit & 1<<i: cand[i] = 1 if cand.count(1) != k-1: continue mx = a[0] for i in range(1, n): if cand[i-1]: if a[i] <= mx: ...
s659619115
p03752
u583285098
1599879120
Python
Python (3.8.2)
py
Runtime Error
66
9200
401
n, k = map(int, input().split()) a = list(map(int, input().split())) ans = 10**9 for i in range(1, 2**n, 2): if not i & 1 or k != sum([i >> j & 1 for j in range(n)]): continue pre = a[0] cost = 0 for j in range(1, n): if i >> j & 1: tmp = max(pre - a[j] + 1, 0) p...
s223628431
p03752
u523087093
1596987775
Python
Python (3.8.2)
py
Runtime Error
23
9080
718
N, K = map(int, input().split()) buildings = list(map(int, input().split())) # a[1:]で大きさが上位K-1についてフラグを付ける # フラグがついているのと前回のものの差分+1をしていく # この処理をK-1回行った段階で終了させる target_list = sorted(buildings[1:], reverse=True)[:K-1] i = 0 #ターゲットリストの添え字 cost = 0 before_building = buildings[0] for building in buildings[1:]: if bui...
s092479561
p03752
u489691149
1593984481
Python
Python (3.8.2)
py
Runtime Error
29
9256
755
from itertools import combinations n,k=map(int,input().split()) lst=list(map(int,input().split())) work=lst[0] ini=[x-work for x in lst] ini_seen=[0] work=0 for i in range(1,n): if ini[i]>work: work=ini[i] ini_seen.append(i) mn=None for x in combinations(range(n-len(ini_seen)),k-len(ini_seen)): ...
s392473496
p03752
u880480312
1592849506
Python
Python (3.8.2)
py
Runtime Error
26
9068
993
#<14> #(point) #全探索によってどの建物が見えるようにするかを決めて必要な費用を計算。 #建物が見える = それより左にある建物maxより1大きいなので左から線形に #最大値を更新、計算量は高々n_c_kのcombについてO(N)の操作なのでおk from itertools import combinations n, k = map(int,input().split()) a = list(map(int,input().split())) mn = 10 ** 18 for b in combinations(range(1, n),k - 1):#一番左は固定 mx = a[0] #初期値=一番左の...
s629044955
p03752
u312666261
1591578647
Python
Python (3.4.3)
py
Runtime Error
63
3572
552
import copy n, k = map(int, input().split()) alist = list(map(int, input().split())) ans = 10**20 count = 0 tempbin = "" maxx = 0 for i in range(2**n): tempbin = format(i,'b') tempbin = tempbin.zfill(n) count = 0 templist = alist.copy() if tempbin.count("1") != k: continue for j in ran...
s278956542
p03752
u227082700
1591561324
Python
Python (3.4.3)
py
Runtime Error
17
2940
144
n,k=map(int,input().split()) a=list(map(int,input().split())) b=sum(sorted(a[1:])[::-1])[:k-1] s=sum(i for i in range(2,k+1)) print(max(s-b,0))
s268480112
p03752
u227082700
1591561297
Python
Python (3.4.3)
py
Runtime Error
17
2940
144
n,k=map(int,input().split()) a=list(map(int,input().split())) b=sum(sorted(a[1:]])[::-1])[:k-1] s=sum(i for i in range(2,k+1)) print(max(s-b,0))
s357221302
p03752
u775383541
1591465478
Python
Python (3.4.3)
py
Runtime Error
17
2940
973
#include <bits/stdc++.h> // #include <iostream> #include <vector> #include <algorithm> #include <string> #include <math.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<n;i++) #define rep2(i,a,b) for(int i=(a);i<(b);i++) template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;} t...
s936800788
p03752
u459419927
1591223045
Python
Python (3.4.3)
py
Runtime Error
17
3064
754
N, K = list(map(int, input().split())) height = list(map(int, input().split())) height2=height.copy() ans = 10 ** 10 # if N==K: # cost=0 # for i in range(1,N): # if height2[i-1]>=height2[i]: # cost+=height2[i-1]-height2[i]+1 # height2[i]+=height2[i-1]-height2[i]+1 # print(cos...
s170547516
p03752
u847923740
1591221679
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38256
407
# https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_b from itertools import combinations N,K=map(int,input().split()) a=list(map(int,input().split())) minc=10**12 ai=[i for i in range(N)] for i in combinations(ai,K): ac=a[:] cost=0 i=list(i) for j in range(1,K): costt=max(max(ac[:i[j]])-ac[i[j]...
s106664202
p03752
u847923740
1591220955
Python
PyPy3 (2.4.0)
py
Runtime Error
187
39920
474
# https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_b from itertools import combinations N,K=map(int,input().split()) a=list(map(int,input().split())) upend=N-1 for i in range(N): if a[i]>a[i+1]: upend=i break minc=10**12 for i in combinations(a[upend+1:],K): cost=0 l=[a[j] for j in range(u...
s257231791
p03752
u847923740
1591220744
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38256
340
# https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_b from itertools import combinations N,K=map(int,input().split()) a=list(map(int,input().split())) minc=10**12 for i in combinations(a,K): cost=0 for j in range(1,K): costt=max(i[j-1]-i[j]+1,0) i[j]+=costt cost+=costt minc=min(cost...
s000884355
p03752
u459419927
1591218277
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38256
567
N,K=list(map(int,input().split())) height=list(map(int,input().split())) ans=10**10 for i in range(2**N): cost=0 height2=height.copy() for j in range(N): if i>>j&1: count=0 for k in range(j): if height2[k]>=height2[j]: cost+=height2[k]-heig...
s336172095
p03752
u993435350
1590095991
Python
Python (3.4.3)
py
Runtime Error
638
6940
539
import copy N,K = map(int,input().split()) A = list(map(int,input().split())) ans = [None for i in range(2 ** (N - 1))] seen = 1 #[[A[j] for j in range(i,N) if A[j] > A[i]] for i in range(0,N)] for i in range(2 ** (N - 1)): AA = copy.deepcopy(A) cost = 0 for j in range(N - 1): m = max(AA[:j + 1]) a = ...
s443731409
p03752
u993435350
1590095125
Python
Python (3.4.3)
py
Runtime Error
23
3444
582
import copy N,K = map(int,input().split()) A = list(map(int,input().split())) ans = 10 ** 12 seen = 1 #[[A[j] for j in range(i,N) if A[j] > A[i]] for i in range(0,N)] for i in range(2 ** (N - 1)): AA = copy.deepcopy(A) cost = 0 con = 0 for j in range(N - 1): m = max(AA[:j + 1]) W #print(AA[:j + ...
s145966523
p03752
u033602950
1589352044
Python
PyPy3 (2.4.0)
py
Runtime Error
190
40428
386
n,k = list(map(int, input().split())) a=list(map(int, input().split())) ans=[] for i in range(1<<n): if bin(i).count("1")==k: cst=0 use=a.copy() for u in range(1,n): if(i>>u&1): left_max=max(use[:u]) cst+=left_max-use[u]+1 ...
s135211888
p03752
u033602950
1589352006
Python
PyPy3 (2.4.0)
py
Runtime Error
192
40428
386
n,k = list(map(int, input().split())) a=list(map(int, input().split())) ans=[] for i in range(1<<n): if bin(i).count("1")==k: cst=0 use=a.copy() for u in range(1,n): if(i>>u&1): left_max=max(use[:u]) cst+=left_max-use[u]+1 ...
s332735972
p03752
u135454978
1589326738
Python
Python (3.4.3)
py
Runtime Error
17
3064
1082
# Square869120Contest #4 B - Buildings are Colorful!  import sys N, K = map(int, sys.stdin.readline().strip().split()) a = list(map(int, sys.stdin.readline().strip().split())) if K == 0: break def dfs(height=a[0], cost=0, target=K, can_see=1, i=1): if can_see >= target: # print('height', height) ...
s847644109
p03752
u135454978
1589326693
Python
Python (3.4.3)
py
Runtime Error
17
3192
1080
# Square869120Contest #4 B - Buildings are Colorful!  import sys N, K = map(int, sys.stdin.readline().strip().split()) a = list(map(int, sys.stdin.readline().strip().split())) if K == 0: break def dfs(height=a[0], cost=0, target=K, can_see=1, i=1): if can_see >= target: # print('height', height) ...
s386471416
p03752
u785883180
1589041979
Python
PyPy3 (2.4.0)
py
Runtime Error
191
41068
490
n,k=map(int,input().split()) a=list(map(int,input().split())) ans=float("inf") for i in range(2**n): bit=[(i>>j)&1 for j in range(n)] if sum(bit)==k and bit[0]: cost,kijun=0,a[0] for j in range(n): if not bit[j]: kijun=max(kijun,a[j+1]) continue ...
s615734858
p03752
u785883180
1589041860
Python
PyPy3 (2.4.0)
py
Runtime Error
211
42844
468
n,k=map(int,input().split()) a=list(map(int,input().split())) ans=float("inf") for i in range(2**n): bit=[(i>>j)&1 for j in range(n)] if sum(bit)==k and bit[0]: cost,kijun=0,a[0] for j in range(n): if not bit[j]: kijun=max(kijun,a[k+1]) elif a[k+1]>=kijun+...
s312147958
p03752
u785883180
1589041288
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38256
398
n,k=map(int,input().split()) a=list(map(int,input().split())) ans=float("inf") for i in range(2**n): if sum(bin(i))==k and (i>>0)&1: l=[] tmp=0 for j in range(n): if (i>>j)&1: l.append(a[j]) for k in range(len(l)-1): p=+l[k]+1-l[k+1] if p>0: ...
s243175781
p03752
u474484450
1588265091
Python
Python (3.4.3)
py
Runtime Error
18
3064
527
cin = open(0).read().strip().split('\n') n, k = map(int, cin[0].split(' ')) a = list(map(int, cin[1].split(' '))) ret = 0 target = [a[0]+i for i in range(1, k)] for idx in range(2**(n-1)): cnt = 0 tmp = 0 for i in range(n): if (idx>>i) & 1: tmp += target[cnt] - a[i+1] if target[cnt] > a...
s281120733
p03752
u677121387
1587499879
Python
Python (3.4.3)
py
Runtime Error
18
3064
408
from itertools import combinations as comb N,K = map(int,input().split()) a = [int(i) for i in input().split()] ans = float("INF") for c in comb(range(1,N),K-1): cnt = 0 color = 0 mh = a[0] for i in range(1,N): if i == c[color]: cnt += max(mh-a[i]+1,0) idx += 1 ...
s317284418
p03752
u339199690
1586993806
Python
Python (3.4.3)
py
Runtime Error
17
2940
709
N, K = map(int, input().split()) A = list(map(int, input().split())) res = 1000000000 for bit in range(2 ** N): b = [int(bin(bit)[i + 2]) for i in range(len(bin(bit)) - 2)] if b.count(1) >= K: b.reverse() b_index = -1 height = 0 cnt = 0 while True: sub = 0 ...
s242150126
p03752
u995062424
1586836093
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38256
632
import copy N, K = map(int, input().split()) a = list(map(int, input().split())) ans = [] for i in range(2**N): s = a.copy() cnt = 0 tmp = 0 henkou = [False for _ in range(N)] for j in range(N): if((i >> j)&1): henkou[j] = True bill = s[0] for k in range(1, N): ...
s869151886
p03752
u477977638
1586027109
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38256
629
import sys input = sys.stdin.readline input = sys.stdin.buffer.readline def RD(): return sys.stdin.read() def II(): return int(input()) def MI(): return map(int,input().split()) def LI(): return list(map(int,input().split())) def TI(): return tuple(map(int,input().split())) # mod=10**9+7 # rstrip().decode('utf-8') ...
s579345995
p03752
u969277466
1585269667
Python
PyPy3 (2.4.0)
py
Runtime Error
200
41196
716
n,k = map(int,input().split()) a = list(map(int,input().split())) ans = 1145141919810364364334 for i in range(1,2**n): ls = [0] * n qq = [] for j in range(n): if (i >> j) & 1: ls[j] = 1 qq.append(j) if sum(ls) < k: continue elif ls[...
s240158005
p03752
u705857261
1584205165
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38384
2199
#!/usr/bin/env python3 N, K = map(int, input().split()) l_height = list(map(int, input().split())) # print(N, K) # print(l_height) costs = [] if N == K: cost = 0 max_height = l_height[0] for i in range(1, N): if max_height >= l_height[i]: cost += (max_height + 1) - l_height[i] ...
s392517256
p03752
u705857261
1584205141
Python
PyPy3 (2.4.0)
py
Runtime Error
170
38384
2670
#!/usr/bin/env python3 N, K = map(int, input().split()) l_height = list(map(int, input().split())) # print(N, K) # print(l_height) costs = [] if N == K: cost = 0 max_height = l_height[0] for i in range(1, N): if max_height >= l_height[i]: cost += (max_height + 1) - l_height[i] ...
s266500653
p03752
u707444776
1583995052
Python
Python (3.4.3)
py
Runtime Error
44
3064
665
from bisect import bisect_left def dfs(index): global ans if index == N: if blst.count(1) == K: tmp = a[bisect_left(blst, 1)] anstmp = 0 for i in range(N): if blst[i] == 0:continue if tmp >= a[i]: anstmp += tmp - a[i...
s517015685
p03752
u261103969
1582926918
Python
PyPy3 (2.4.0)
py
Runtime Error
180
38640
1045
# import math # import bisect #import numpy as np import itertools import copy import sys input = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n, k = list(map(int,input().split())) a = list(map(int,input().split())) cmb = list(itertools.combinations(...
s236207188
p03752
u261103969
1582924578
Python
PyPy3 (2.4.0)
py
Runtime Error
186
39864
681
# import math # import bisect import numpy as np import itertools # import copy import sys input = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n, k = list(map(int,input().split())) a = list(map(int,input().split())) cmb = list(itertools.combinations...
s307189899
p03752
u886747123
1582557311
Python
Python (3.4.3)
py
Runtime Error
39
3444
850
# B - Buildings are Colorful! import sys input = sys.stdin.buffer.readline import itertools N, K = map(int, input().split()) original_a = list(map(int, input().split())) if K == 1: print(0) exit() ans = float("inf") for visible_building_indices in list(itertools.combinations(list(range(N)), K)): a = or...
s079521208
p03752
u644907318
1582492063
Python
PyPy3 (2.4.0)
py
Runtime Error
162
38256
478
import ipdb from itertools import combinations N,K = map(int,input().split()) A = list(map(int,input().split())) cmin = 10**12 for x in combinations(range(1,N),K-1): C = A[:] B = [0] B += x B = sorted(B) cnt = 0 for i in range(1,K): j0 = B[i-1] j1 = B[i] h = 0 for...
s660924513
p03753
u024612773
1492799497
Python
PyPy3 (2.4.0)
py
Runtime Error
1065
156420
949
n,m,q=map(int,input().split()) a=list(map(int,input().split())) def count_group(size): cc = [False]*size for i in range(q): j = 0 while a[i]+m*j < size: cc[a[i]+m*j] = True j += 1 gg = [0]*size ox = [-1, 0, 1, 0] oy = [0, -7, 0, 7] def dfs(i, g): ...
s692202673
p03754
u227082700
1591558297
Python
PyPy3 (2.4.0)
py
Runtime Error
1063
126976
1502
def main(): import sys input=sys.stdin.readline n=int(input()) identify=0 edges = [[] for _ in range(n)] indexedges = [[] for _ in range(n)] for _ in range(n-1): u,v=map(int,input().split()) u-=1 v-=1 indexedges[v].append(len(edges[u])) indexedges[u].append(len(edges[v])) edges[u]....
s533380013
p03754
u227082700
1591558129
Python
PyPy3 (2.4.0)
py
Runtime Error
338
116472
1460
def main(): n,*uv=map(int,open(0).read().split()) identify=0 edges = [[] for _ in range(n)] indexedges = [[] for _ in range(n)] for i in range(n-1): u,v=uv[i*2],uv[i*2+1] indexedges[v].append(len(edges[u])) indexedges[u].append(len(edges[v])) edges[u].append(v) edges[v].append(u) dp = [i...
s939606680
p03754
u487523716
1588299274
Python
Python (3.4.3)
py
Runtime Error
1061
93616
6494
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 #https://atcoder.jp/contests/s8pc-4/tasks/s8pc_4_d?lang=ja inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 4 1 2 2 3 2 4 '''[1:] input2 =''' 4 1 2 2 4 4...
s322797787
p03754
u487523716
1588224088
Python
Python (3.4.3)
py
Runtime Error
1063
119796
5302
#recursion-version #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 import sys sys.setrecursionlimit(1000000) inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 4 1 2 2 3 2 4 '''[1:] input2 =''' 7 1 2 1...
s550343921
p03754
u487523716
1588207596
Python
Python (3.4.3)
py
Runtime Error
1066
154992
4823
#recursion-version #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 import sys sys.setrecursionlimit(1000000) inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 12 1 2 2 3 2 4 4 5 5 6 5 7 6 8 8 9 2 10 10...
s421417099
p03754
u487523716
1588205023
Python
PyPy3 (2.4.0)
py
Runtime Error
1064
128844
4789
#recursion-version #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 import sys sys.setrecursionlimit(10000) inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 4 1 2 2 3 2 4 '''[1:] input2 =''' 7 1 2 1 3...
s525843842
p03754
u487523716
1588204872
Python
Python (3.4.3)
py
Runtime Error
1065
141600
4789
#recursion-version #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 import sys sys.setrecursionlimit(10000) inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 4 1 2 2 3 2 4 '''[1:] input2 =''' 7 1 2 1 3...
s148600452
p03754
u487523716
1587319846
Python
Python (3.4.3)
py
Runtime Error
1066
141624
4883
#recursion-version #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A&lang=jp #http://penguinshunya.hatenablog.com/entry/2019/07/09/003006 import sys sys.setrecursionlimit(10000) inpPh = 0 debug = True #debug = False if not debug: inpPh = 0 input1 =''' 4 1 2 2 3 2 4 '''[1:] input2 =''' 4 1 2 2 4...
s567020473
p03759
u568426505
1600136522
Python
Python (3.8.2)
py
Runtime Error
27
8924
74
a,b,c=map(int,input().split(" ")) print("YES") if b-a==c-b else print("NO)
s996982119
p03759
u886902015
1599852957
Python
Python (3.8.2)
py
Runtime Error
21
8956
83
a,b,c=int(input().split()) if (b-a)==(c-b): print("YES") else: print("NO")
s996589877
p03759
u886902015
1599852899
Python
Python (3.8.2)
py
Runtime Error
24
9076
78
a,b,c=int(input().split()) if b-a==c-b: print("YES") else: print("NO")
s682555770
p03759
u011872685
1599356121
Python
Python (3.8.2)
py
Runtime Error
22
8872
85
#58 a,b,c=map(int,input().split()) if b-a=c-b: print('YES') else: print('NO')
s564877121
p03759
u011872685
1599356087
Python
Python (3.8.2)
py
Runtime Error
23
8948
85
#58 a,b,c=map(int,input().split()) if b-a=c-b: print('Yes') else: print('No')
s848797160
p03759
u074220993
1599338010
Python
Python (3.8.2)
py
Runtime Error
24
8944
69
a, b = input().split() print('H' if (a == 'H') ^ (b == 'D') else 'D')
s291937032
p03759
u693566873
1599254787
Python
PyPy3 (7.3.0)
py
Runtime Error
87
74744
81
a, b, c = map(int, input()) if b - a == c - b: print('YES') else: print('NO')
s075716596
p03759
u612975321
1599131479
Python
Python (3.8.2)
py
Runtime Error
26
8944
82
a, b, c = = map(int,input().split()) print('YES') if a == b == c else print('NO')
s097213047
p03759
u708211626
1598900388
Python
Python (3.8.2)
py
Runtime Error
21
8908
90
a=list(map(int,input().split())) if a[0]+a[2]=2*a[1]: print('YES') else: print('NO')