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
s575724008
p03781
u393512980
1563935913
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38256
771
import sys input = sys.stdin.readline N, K = map(int, input().split()) a = list(map(int, input().split())) S, f = [set() for i in range(N+1)], [[0] * K for i in range(N+1)] S[0].add(0) f[N][0] = 1 for i, (al, ar) in enumerate(zip(a, a[::-1]), 1): for j in S[i-1]: S[i].add(j) x = al + j if x...
s681927080
p03781
u350997995
1554181959
Python
Python (3.4.3)
py
Runtime Error
73
4076
161
X = int(input()) def dfs(t, x): global X if t>X: return X if x==X: return t-1 return min(dfs(t+1,x+t),dfs(t+1,x)) print(dfs(0,0))
s096192823
p03781
u047535298
1542808259
Python
Python (3.4.3)
py
Runtime Error
78
3984
315
def reduce (last, count, time): if last == 0: return time-1 if last-time==0 or last-time > time: return reduce(last-time, count+1, time+1) else: return reduce(last, count, time+1) if __name__ == '__main__': X = int(input()) ret = reduce(X, 0, 1) print(ret)
s942857206
p03781
u333139319
1539110499
Python
Python (3.4.3)
py
Runtime Error
17
2940
110
x = int(input()) for i in range(1,x//2+1): a = a + i if a >= x: print(x//2) else: print(x//2+1)
s470388725
p03781
u284119783
1529480073
Python
Python (3.4.3)
py
Runtime Error
17
3060
217
N, K = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) ans = N t = 0 for i in range(N-1, -1, -1) : if t+a[i] < K : t += a[i] else : ans = min(ans, i) print(ans)
s103516080
p03781
u777923818
1515110957
Python
PyPy3 (2.4.0)
py
Runtime Error
186
38768
686
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) from copy import deepcopy from operator import add from itertools import accumulate N, K = inpl() A = sorted(inpl()) S = list(accumulate(A, add)) A = A[::-1] DP = [False for _ in range(K)] DP[0] = 1 OK = [False for _ in range(N)] for i, a in e...
s636271929
p03781
u777923818
1515109976
Python
PyPy3 (2.4.0)
py
Runtime Error
195
38768
568
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) from copy import deepcopy N, K = inpl() A = sorted(inpl(), reverse=True) DP = [False for _ in range(K)] DP[0] = 1 OK = [False for _ in range(N)] for i, a in enumerate(A): DP0 = deepcopy(DP) if a >= K: OK[i] = True cont...
s353755267
p03781
u985443069
1489967381
Python
Python (3.4.3)
py
Runtime Error
18
3064
1044
import sys sys.stdin = open('d3.in') n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() prefix = [set() for _ in range(n + 1)] # suffix = [set() for _2 in range(n + 1)] prefix[0] = {0} for i in range(n): for v in prefix[i]: prefix[i+1].add(v) if v + a[i] <= k: ...
s185730275
p03781
u985443069
1489965886
Python
Python (3.4.3)
py
Runtime Error
19
3316
961
# import sys # sys.stdin = open('d3.in') n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() prefix = [set() for _ in range(n + 1)] suffix = [set() for _2 in range(n + 1)] prefix[0] = {0} for i in range(n): for v in prefix[i]: if v + a[i] <= k: prefix[i+1].add(v + a[...
s880964668
p03781
u271456715
1489898530
Python
Python (3.4.3)
py
Runtime Error
18
3064
994
import sys [n, k] = [int(x) for x in input().strip().split()] a = [int(x) for x in input().strip().split()] a.sort() if sum(a) < k: print(n) sys.exit() s = 0 for i in range(len(a)): s += a[i] if s >= k: break aa = [x for x in a if x < a[i]] bb = [x for x in a if x < k] cc = [] for i in range(len(aa)): ...
s405407930
p03781
u272028993
1489891612
Python
PyPy2 (5.6.0)
py
Runtime Error
36
28140
509
n,k=map(int,raw_input().split()) a=map(int,raw_input().split()) a.sort() used=[False]*n idx=n-1 cnt=0 while True: if idx-cnt<0: break tmp=sum(a[idx-cnt:idx+1]) if tmp<k: cnt+=1 continue for i in xrange(idx-cnt,idx+1): used[i]=True tmp-=a[idx-cnt] for i in xrange(i...
s940151159
p03781
u140806166
1489885773
Python
Python (3.4.3)
py
Runtime Error
18
2940
93
x = input() d = 0 for i in range(1, 10 ** 6): d += i if x <= d: print(i) break
s149824372
p03782
u786020649
1595369046
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74460
2669
import sys import numpy as np sys.setrecursionlimit(4100000) def biser(lst,func): n=len(lst) nh=n//2 if n==1: if func(lst[0]): return lst[0] else: return -1 if func(lst[nh]): return biser(lst[nh:],func) else: return biser(lst[:nh],func) def ...
s569182278
p03782
u543954314
1587743339
Python
Python (3.4.3)
py
Runtime Error
2104
155340
620
n, k = map(int,input().split()) a = list(map(int,input().split())) def trans(v): l = [0]*(k+1) for i in range(k+1): l[i] = (v&1) v >>= 1 return l a.sort() lef = [1]*n rig = [1]*n mask = (1 << (k+1)) - 1 for i in range(n-1): lef[i+1] = lef[i] | (lef[i] << a[i]) & mask rig[-i-2] = rig[-i-1] | (rig[-i-1...
s248207316
p03782
u620480037
1585272929
Python
PyPy3 (2.4.0)
py
Runtime Error
271
43228
1120
N,K=map(int,input().split()) b=list(map(int,input().split())) b.sort() a=[] for i in range(N): if b[i]<K: a.append(b[i]) N=len(a) ans=0 #print(bin((1<<K)>>1)) C=[1] n=1 for i in range(N): n=n|n<<a[i] n%=(1<<K) C.append(n) #print(C) #print(bin(n)) if N<=10: for i in range(N): n=C[...
s157942843
p03782
u620480037
1585106383
Python
PyPy3 (2.4.0)
py
Runtime Error
2106
44508
848
N,K=map(int,input().split()) b=list(map(int,input().split())) b.sort() a=[] for i in range(N): if b[i]<K: a.append(b[i]) N=len(a) ans=0 #print(bin((1<<K)>>1)) C=[1] n=1 for i in range(N): n=n|n<<a[i] n%=(1<<K) C.append(n) #print(C) #print(bin(n)) P=N//2 n=C[P] for x in range(P+1,N): n=n|...
s149310710
p03782
u941407962
1581081794
Python
PyPy3 (2.4.0)
py
Runtime Error
193
41712
445
N, K = map(int, input().split()) A = list(map(int, input().split())) A = [a for a in A if a <K] N = len(A) #dpm = [+1) for _ in range(N+1)] dpm = [0]*(N+1) dpm[0] = 1<<(K-1) for i, a in enumerate(A): dpm[i+1] = dpm[i] | (dpm[i] >> a) r = 0 dp2 = 1 for i, a in enumerate(A[::-1]): for j in range(a): if d...
s092557025
p03782
u102461423
1575517631
Python
Python (3.4.3)
py
Runtime Error
71
3572
830
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools """ ・「必要」とは~~が存在 ・x を含まない、[K-x,K) 内の総和が存在 ・集合を指定すると、ある値段より上側 ・全体としても単調性がある """ N,K,*A = map(int,read().split()) A.sort() A = [x if x <= K else K + 1 for x in A] mask = (1 << K) - 1 ...
s719497783
p03782
u102461423
1575517287
Python
Python (3.4.3)
py
Runtime Error
71
3572
794
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools """ ・「必要」とは~~が存在 ・x を含まない、[K-x,K) 内の総和が存在 ・集合を指定すると、ある値段より上側 ・全体としても単調性がある """ N,K,*A = map(int,read().split()) A.sort() A = [x if x <= K else K + 1 for x in A] mask = (1 << K) - 1 ...
s305865564
p03782
u543954314
1571325689
Python
Python (3.4.3)
py
Runtime Error
2128
396788
957
_,k = map(int,input().split()) a = list(filter(lambda x:x<k,list(map(int,input().split())))) n = len(a) a.sort(reverse=True) dpf = [[False]*k for _ in range(n)] dpb = [[False]*k for _ in range(n)] dpf[0][0] = True dpb[-1][0] = True for i in range(n-1): wf = a[i] wb = a[-(i+1)] for j in range(k): if dpf[i][j...
s196651233
p03782
u543954314
1571325485
Python
Python (3.4.3)
py
Runtime Error
2128
396788
949
_,k = map(int,input().split()) a = list(filter(lambda x:x<k,list(map(int,input().split())))) n = len(a) a.sort(reverse=True) dpf = [[False]*k for _ in range(n)] dpb = [[False]*k for _ in range(n)] dpf[0][0] = True dpb[0][0] = True for i in range(n-1): wf = a[i] wb = a[-(i+1)] for j in range(k): if dpf[i][j]...
s657958538
p03782
u543954314
1571322985
Python
Python (3.4.3)
py
Runtime Error
17
3064
565
def main(): n,k = map(int,input().split()) a = list(filter(lambda x:x<k,list(map(int,input().split())))) n = len(a) a.sort(reverse=True) ng = -1 ok = n while ok-ng > 1: mid = (ok+ng)//2 dp = [False]*(k+1) dp[0] = True f = 0 for j in range(n): if j == mid: continue w = a[j] for ...
s832481597
p03782
u543954314
1571251246
Python
PyPy3 (2.4.0)
py
Runtime Error
179
39280
517
n,k = map(int,input().split()) a = list(map(int,input().split())) a.sort(reverse=True) hi = -1 lo = n while lo-hi>1: mid = (lo+hi)//2 if a[mid] >= k: hi = mid else: lo = mid ng = hi ok = n while ok-ng > 1: mid = (ok+ng)//2 dp = [False]*(k+1) dp[0] = True f = 1 for j in range(n): if j == mid:...
s609155781
p03782
u794173881
1561343652
Python
PyPy3 (2.4.0)
py
Runtime Error
2180
1138312
607
n, k = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) def subset_sum(a): n = len(a) dp = [[0]*(k + 1) for i in range(n + 1)] dp[0][0] = 1 for i in range(n): for j in range(k+1): if j - a[i] < 0: dp[i+1][j] = dp[i][j] else: ...
s948839198
p03782
u794173881
1561343614
Python
Python (3.4.3)
py
Runtime Error
2139
585608
607
n, k = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) def subset_sum(a): n = len(a) dp = [[0]*(k + 1) for i in range(n + 1)] dp[0][0] = 1 for i in range(n): for j in range(k+1): if j - a[i] < 0: dp[i+1][j] = dp[i][j] else: ...
s569194649
p03782
u218843509
1548746392
Python
PyPy3 (2.4.0)
py
Runtime Error
335
40048
697
import sys n, k = map(int, input().split()) a = sorted(list(map(int, input().split()))) #print(a) fr = 0 ba = n+1 def check(mi): x = a[mi-1] if x >= k: return True #print(mi) dp = [False] * (k+1) dp[0] = True for i in range(n): if i == mi-1: continue y = a[i...
s929747145
p03782
u619631862
1544593284
Python
PyPy3 (2.4.0)
py
Runtime Error
2166
909192
951
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] [N,K]=i2() a=i2() a.sort() def f(b,c): dp=[[0 for i in range(K)]for j in range(len(b))] dp[0][b[0]]=1 d=0 for i in range(1,len(b)): for j in range(K): dp[i][j]+=dp[i-1][j] ...
s563701937
p03782
u236127431
1544215046
Python
PyPy3 (2.4.0)
py
Runtime Error
2108
42896
522
from bisect import bisect N,K=map(int,input().split()) a=[int(i) for i in input().split()] a.sort() def dp(n): d=[False]*(K+1) d[0]=True for i in range(N): if i!=n: for w in range(K)[::-1]: if w+a[i]<=K and d[w]: d[w+a[i]]=True for i in range(K-a[n],K): if d[i]: return True...
s791043340
p03782
u177398299
1538434694
Python
PyPy3 (2.4.0)
py
Runtime Error
172
39408
667
# https://beta.atcoder.jp/contests/arc070/submissions/2980516 from bisect import bisect_left N, K = map(int, input().split()) A = sorted(map(int, input().split())) A = A[:bisect_left(A, K)] dp = [False] * K dp[0] = True curr_max = 0 ans = len(A) for i, a in reversed(enumerate(A)): # a[i - 1]を使ってa[i]が必要ならa[i - 1]も必...
s066954572
p03782
u218843509
1535181307
Python
Python (3.4.3)
py
Runtime Error
2116
199284
1026
N, K = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) def check(i): if i == 0: b = a[1:] elif i == N - 1: b = a[:N - 1] else: b = a[:i] + a[i+1:] #print(b) ok = False dp = [[False] * K for _ in range(N - 1)] dp[0][b[0]] = True if K - a[i] <= b[0] < K: ok = True for j in ra...
s098434287
p03782
u123518636
1535083986
Python
PyPy2 (5.6.0)
py
Runtime Error
2106
35688
2493
#!/usr/bin/python # -*- coding: utf-8 -*- import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq # decimal.getcontext().prec = 50 # sys.setrecursionlimit(10000) # MOD = 10**9 + 7 def solve(f): n, k = f.read_int_list() a = f.read_int_list() a.sort(reverse=True) # if n > ...
s705914014
p03782
u340781749
1533957014
Python
PyPy3 (2.4.0)
py
Runtime Error
2126
331656
1687
import bisect def preliminary(k, aaa): dp = [False] * k dp[0] = True curr_max = 0 fwd = {} pa = aaa[0] pdp, ppdp = dp[:], None for a in aaa: if pa != a: fwd[pa] = ppdp for i in range(min(curr_max, k - a - 1), -1, -1): if dp[i]: dp[i +...
s206606878
p03782
u340781749
1533954643
Python
PyPy3 (2.4.0)
py
Runtime Error
171
39408
1555
import bisect def preliminary(k, aaa): dp = [False] * k dp[0] = True curr_max = 0 fwd = [] for a in aaa: for i in range(min(curr_max, k - a - 1), -1, -1): if dp[i]: dp[i + a] = True fwd.append(dp.copy()) curr_max += a dp = [False] * k dp...
s997662596
p03782
u340781749
1533953293
Python
PyPy3 (2.4.0)
py
Runtime Error
178
39280
1583
import bisect def preliminary(k, aaa): dp = [False] * k dp[0] = True curr_max = 0 fwd = [] for a in aaa: for i in range(min(curr_max, k - a - 1), -1, -1): if dp[i]: dp[i + a] = True fwd.append(dp.copy()) curr_max += a dp = [False] * k dp...
s599946866
p03782
u340781749
1533949988
Python
Python (3.4.3)
py
Runtime Error
2112
62940
996
import bisect import numpy as np from scipy.ndimage.interpolation import shift def preliminary(k, aaa): dp = np.zeros(k, np.uint8) dp[0] = 1 fwd = [] for a in aaa: dp |= shift(dp, a) fwd.append(dp.copy()) dp = np.zeros(k, np.uint8) dp[0] = 1 bwd = [] for a in reversed...
s659991936
p03782
u340781749
1533947208
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38384
613
import bisect import numpy as np from scipy.ndimage.interpolation import shift def judge(e): ae = aaa[e] dp = np.zeros(k, np.uint8) dp[0] = 1 for i, a in enumerate(aaa): if i == e: continue dp |= shift(dp, a) return dp[-ae:].any() def solve(k, aaa): l = 0 r = ...
s394758443
p03782
u075012704
1532365082
Python
PyPy3 (2.4.0)
py
Runtime Error
701
43740
819
N, K = map(int, input().split()) A = list(map(int, input().split())) A = sorted([a for a in A if a < K]) N = len(A) S = sum(A) # あああああああああああああああああああ\(^o^)/ if S - A[0] < K: print(0) exit() l, r = -1, N while r - l > 1: m = (l + r) // 2 B = A[:m] + A[m + 1:] if S - A[m] < K - A[m]: l = m ...
s049522693
p03782
u777923818
1515111038
Python
PyPy3 (2.4.0)
py
Runtime Error
194
40048
689
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) from copy import deepcopy from operator import add from itertools import accumulate N, K = inpl() A = sorted(inpl()) S = list(accumulate(A, add)) A = A[::-1] DP = [False for _ in range(K)] DP[0] = 1 OK = [False for _ in range(N)] for i, a in...
s951561926
p03782
u777923818
1515110974
Python
PyPy3 (2.4.0)
py
Runtime Error
186
39664
695
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) from copy import deepcopy from operator import add from itertools import accumulate N, K = inpl() A = sorted(inpl()) S = list(accumulate(A, add)) A = A[::-1] DP = [False for _ in range(K)] DP[0] = 1 OK = [False for _ in range(N)] for i, a in e...
s252207952
p03782
u433219236
1491007887
Python
Python (2.7.6)
py
Runtime Error
2117
213480
716
# coding: utf-8 n, k = map(int, raw_input().split()) a = list(map(int, raw_input().split())) a.sort() left = 0 right = n - 1 while left != right: mid = (left + right + 1) / 2 dp = [[0 for j in range(k + 1)] for i in range(n + 1)] dp[0][0] = 1 for i in range(n): for j in range(k + 1): ...
s263927391
p03782
u762603420
1490731277
Python
Python (3.4.3)
py
Runtime Error
2122
222716
681
N, K = list(map(int, input().split())) nums = list(map(int, input().split())) nums.sort() if sum(nums) < K or nums[0] >= K: print(str(N)) quit() dp = [[False for i in range(0, N)] for j in range(0, K)] import numpy as np res = N for i in range(0, N): dp_arr = np.array(dp[:]) dp_arr[0, :] = True ...
s316545489
p03782
u762603420
1490726871
Python
Python (3.4.3)
py
Runtime Error
2117
214900
888
N, K = list(map(int, input().split())) nums = list(map(int, input().split())) nums.sort() if sum(nums) < K or nums[0] >= K: print(str(N)) quit() dp = [[0 for i in range(0, N)] for j in range(0, K)] idx = 0 for i in range(1, K): for j in range(0, N): s = sum(nums[:j+1]) if s >= i: ...
s826681028
p03782
u107077660
1490061456
Python
Python (3.4.3)
py
Runtime Error
2104
3732
739
N, K = map(int, input().split()) A = [int(i) for i in input().split()] A.sort() S = sum(A) if S < K: print(N) exit() elif A[0] >= K: print(0) exit() def is_necessary(n): if A[n] >= K: return True dp = [False]*K dp[0] = True dp2 = [False]*K dp2[0] = True can_make = [] can_make2 = [0] for i in range(N): ...
s288359704
p03782
u637175065
1489933519
Python
Python (3.4.3)
py
Runtime Error
2104
10428
984
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return list(map(int, input().split())) def LF(): return list(map(float, input().split())) def II(): return int(input()) def LS(): return input().split() def S():...
s161030984
p03782
u927220534
1489890011
Python
PyPy2 (5.6.0)
py
Runtime Error
2107
56092
1040
from sys import stdin rr = lambda: stdin.readline().strip() rrI = lambda: int(rr()) rrM = lambda: map(int, rr().split()) N,K = rrM() A = rrM() #N,K,A = 3,6,[1,4,3] #N,K,A = 5,20,[3,1,4,1,5] #N,K,A = 6,20,[10,4,3,10,25,2] nogood = sum(A) < K A = [x for x in A if x < K] N = len(A) #For each x, among set S = A-x, #necess...
s447691053
p03782
u477320129
1489888782
Python
PyPy3 (2.4.0)
py
Runtime Error
570
41328
539
def solve(N, K, A): assert N <= 400 and K <= 400 count = 0 for i, a in enumerate(A): flags = [False] * K flags[0] = True for j, aa in enumerate(A): if i == j or aa >= K: continue for k in range(K-1, aa-1, -1): flags[k] |= flags[...
s921858465
p03782
u177721681
1489888384
Python
Python (2.7.6)
py
Runtime Error
14
2948
489
import sys N, K = map(int, sys.stdin.readline().split()) cards = sorted(map(int, sys.stdin.readline().split()) , reverse=True) i = 0 s = 0 while i < N: s += cards[i] if s >= K: s = 0 j = i ...
s144645404
p03783
u823871776
1552087198
Python
Python (3.4.3)
py
Runtime Error
27
4340
1283
import math n = int(input()) N = 400 if n > N: exit() l = [0]*n r = [0]*n for i in range(n): l[i], r[i] = list(map(int, input().split())) dp = [[1000 for i in range(N)] for j in range(n)] for i in range(N): #最初の段は埋めておく。 dp[0][i] = abs(l[ni]-i) if i < l[ni]: d = l[ni] - i elif r[ni] < i: ...
s911515682
p03783
u823871776
1552002981
Python
Python (3.4.3)
py
Runtime Error
113
9332
586
n = int(input()) if n>400: exit() l = [0]*n r = [0]*n for i in range(n): l[i], r[i] = list(map(int, input().split())) N = 400+1 dp = [[0 for i in range(N)] for j in range(n)] # 一番上のブロックを動かした時のコスト for i in range(N): if r[0] < i: d = i-r[0] elif i < l[0]: d = l[0]-i else: d = 0 dp[0][i] = d # 順番...
s223387866
p03783
u226155577
1519613493
Python
PyPy3 (2.4.0)
py
Runtime Error
2149
61400
444
N = int(input()) P = [list(map(int, input().split())) for i in range(N)] INF = 10**18 L = max(r for l, r in P) S = [0]*L l0, r0 = P[0] for i in range(L): S[i] = abs(i - (l0-1)) for i in range(N-1): l0, r0 = P[i] l1, r1 = P[i+1] T = [0]*L for x in range(L): r = INF for y in range(ma...
s505484602
p03783
u226155577
1519613351
Python
Python (3.4.3)
py
Runtime Error
2142
27508
444
N = int(input()) P = [list(map(int, input().split())) for i in range(N)] INF = 10**18 L = max(r for l, r in P) S = [0]*L l0, r0 = P[0] for i in range(L): S[i] = abs(i - (l0-1)) for i in range(N-1): l0, r0 = P[i] l1, r1 = P[i+1] T = [0]*L for x in range(L): r = INF for y in range(ma...
s785264885
p03783
u477320129
1489891175
Python
PyPy3 (2.4.0)
py
Runtime Error
660
65368
834
def solve(N, lefts, rights): assert 1 <= N <= 400 min_l, max_l = min(lefts), max(lefts) max_r = max(rights) assert 1 <= min_l < max_r <= 400 dp = [[float("inf")] * (max_l + 1) for _ in range(N)] dp = [[0] * (max_l + 1)] + dp lefts = (1,) + lefts rights = (max_l,) + rights for i in ra...
s649920135
p03783
u477320129
1489891138
Python
Python (3.4.3)
py
Runtime Error
1014
29888
838
def solve(N, lefts, rights): assert 1 <= N <= 400 min_l, max_l = min(lefts), max(lefts) max_r = max(rights) assert 1 <= min_l < max_r <= 400 dp = [[float("inf")] * (max_l + 1) for _ in range(N)] dp = [[0] * (max_l + 1)] + dp lefts = (1,) + lefts rights = (max_l,) + rights for i in ra...
s830111928
p03783
u477320129
1489891045
Python
PyPy3 (2.4.0)
py
Runtime Error
628
67160
839
def solve(N, lefts, rights): assert 1 <= N <= 400 min_l, max_l = min(lefts), max(lefts) max_r = max(rights) assert 1 <= min_l < max_r <= 400 dp = [[float("inf")] * (max_l + 1) for _ in range(N)] dp = [[0] * (max_l + 1)] + dp lefts = (1,) + lefts rights = (max_l,) + rights for i in ra...
s014611543
p03784
u828766688
1584896612
Python
PyPy3 (2.4.0)
py
Runtime Error
274
38724
63
A,B = map(int,input().split()) print ("Impossible",flush=True)
s605419443
p03784
u864197622
1575525733
Python
Python (3.4.3)
py
Runtime Error
119
3524
352
A, B = map(int, input().split()) X = [i for i in range(N)] Y = [] def chk(a, b): print("?", a, b) return 1 if input() == "Y" else 0 while X: if not Y: Y.append(X.pop()) else: if chk(Y[-1], X[-1]): Y.append(X.pop()) else: Y.pop() print("!", "".join([str(chk...
s431397982
p03784
u692632484
1489899429
Python
Python (3.4.3)
py
Runtime Error
576
3532
422
temp=input().split() A=int(temp[0]) B=int(temp[1]) ans="" count=0 good=0 step=1 if A<B: print("Impossible") else: while True: print("? "+str(count)+" "+str((count+step)%(A+B))) if input()=="Y": good+=1 count+=step step=1 else: step+=1 if good==B: break person=(count)%(A+B) for i in range(A+B...
s300432350
p03785
u465101448
1601254610
Python
PyPy3 (7.3.0)
py
Runtime Error
164
68652
307
N,C,K = list(map(int,input().split())) T=[] for n in range(N): T.append(int(input_())) T.sort() # T ans = 0 dep = 0 c = 1 for t in T: # print('===',t) if c < C and dep > t: c += 1 else: ans += 1 dep = t+K c = 1 # print(ans,dep) print(ans)
s061289190
p03785
u546440137
1600431290
Python
Python (3.8.2)
py
Runtime Error
157
13304
286
n,c,k = map(int,input().split()) t = list(int(input()) for i in range(n)) t.sort() bus = 0 leave = t[0] + k temp = 1 ans = 0 for i in range(1,n): if temp == 0 or leave < t[i]: ans += 1 temp = 1 leave = t[i] + k else: count += 1 print(ans+1)
s620190887
p03785
u341267151
1599778213
Python
Python (3.8.2)
py
Runtime Error
27
8976
241
import math n,c,k=map(int,input().split()) t=[0]*n s=0 a=0 for i in range(n): t[i]=int(input()) if i>0 and a>0: if t[i]-t[i-1]<=k: s+=(a+n)//c a=(a+n)%c else: s+=math.ceil((a+n)/c) a=0 print(s)
s787876376
p03785
u411923565
1599354338
Python
PyPy3 (7.3.0)
py
Runtime Error
202
82812
473
#54 A - Airport Bus N,C,K = map(int,input().split()) T = [int(input()) for _ in range(N)] T = sorted(T,reverse = False) ans = 0 bus = 1 first = T[0] for i in range(1,N+1): # T[i] がバスに乗ることができるとき if (bus < C) and (T[i] <= first + K): bus += 1 # T[i] がバスに乗ることができないとき else: # 新しいバスの first にな...
s373755007
p03785
u255898796
1598633961
Python
Python (3.8.2)
py
Runtime Error
230
14044
346
a = [int(s) for s in input().split()] N = a[0] si = a[1] ti = a[2] s = [int(input()) for i in range(N)] s = sorted(s) X = int(0) ans = int(0) while N != X: X += 1 ans += 1 if N == X: break for i in range(min([si-1,N-X])): if s[X + i] <= s[X-1] + ti: X += 1 else: ...
s639039660
p03785
u255898796
1598633790
Python
Python (3.8.2)
py
Runtime Error
227
13996
345
a = [int(s) for s in input().split()] N = a[0] si = a[1] ti = a[2] s = [int(input()) for i in range(N)] s = sorted(s) X = int(0) ans = int(0) while N != X: X += 1 ans += 1 if N == X: break for i in range(min([si-1,N-X])): if s[X + i] < s[X-1] + ti: X += 1 else: ...
s532698287
p03785
u476124554
1598380169
Python
PyPy3 (7.3.0)
py
Runtime Error
98
74744
755
n,c,k = map(int,input().split()) t = [] for i in range(n): t.append(int(input())) t = sorted(t) bus = [] ans = 1 for i in range(n): if len(bus) < c: #バスの定員に余裕があるとき if not bus: #バスに誰も乗っていなかったらバスに人を乗せる bus.append(t[i]) elif t[i] <= bus[0] + k:#バスに初めて人が乗った時刻にkを足して、それよりt[i]が小さければバスに...
s701505396
p03785
u202560873
1598251022
Python
Python (3.8.2)
py
Runtime Error
197
14004
456
N, C, K = [int(x) for x in input().split()] T = [] for i in range(N): T.append(int(input())) T = sorted(T) T_fast = T[0] passsengers = 1 buss = 0 for i in range(1, N): if T[i] - T_fast > K: T_fast = T[i] buss += 1 passsengers = 1 else: passsengers += 1 if passsenge...
s777102471
p03785
u107915058
1597701164
Python
Python (3.8.2)
py
Runtime Error
157
13336
289
N, C, K = map(int, input().split()) T = list(int(input()) for i in range(N)) T.sort() bus = 1 passenger = 0 limit = T[0] + K for i in range(N): if T[i] <= limit and passenger < c: passenger += 1 else: bus += 1 limit = T[i]+K passenger = 1 print(bus)
s870986915
p03785
u107915058
1597700636
Python
Python (3.8.2)
py
Runtime Error
24
8908
134
bus = 1 time = 0 for i in range(N): if T[i]-time > K: bus +=1 time = T[i] else: time = time print(bus)
s753597411
p03785
u637289184
1597243548
Python
PyPy3 (7.3.0)
py
Runtime Error
204
82108
251
N,C,K = map(int, input().split()) T = [int(input()) for i in range(N)] T.sort() ans=s=0 while s<N: t=T[s]+K sm=1 for i in range(s+1,s+c): if T[i]<t: sm+=1 else: break s+=sm ans+=1 print(ans)
s710051888
p03785
u075303794
1596849497
Python
Python (3.8.2)
py
Runtime Error
1498
143776
264
import bisect N,C,K=map(int,input().split()) T=[int(input()) for _ in range(N)] T.sort() ans=0 i=0 if T[0]+K>=T[-1]: print(1) else: while True: if i==N-1: ans+=1 break i=bisect.bisect_right(T,T[i]+K) print(T,i) ans+=1 print(ans)
s679263638
p03785
u075303794
1596849347
Python
Python (3.8.2)
py
Runtime Error
213
13400
248
import bisect N,C,K=map(int,input().split()) T=[int(input()) for _ in range(N)] T.sort() ans=0 i=0 if T[0]+K>=T[-1]: print(1) else: while True: if i==N-1: ans+=1 break i=bisect.bisect_left(T,T[i]+K) ans+=1 print(ans)
s971715411
p03785
u591503175
1594831257
Python
Python (3.8.2)
py
Runtime Error
171
13316
625
def resolve(): ''' code here ''' N, C, K = [int(item) for item in input().split()] Ts = [int(input()) for _ in range(N)] Ts.sort() res = 0 temp_psg = 0 lim = Ts[0] + K for i in range(N): temp_psg += 1 if Ts[i] > lim: res += 1 temp_psg = 1...
s837256506
p03785
u277429554
1593409303
Python
Python (3.8.2)
py
Runtime Error
27
9084
166
n = int(input()) a = sorted(list(map(int, input().split()))) ans = -1 for i in range(n-1): if a[i]*2 < a[i+1]: ans = i a[i+1] += a[i] print(n-ans-1)
s443578483
p03785
u277429554
1593409106
Python
Python (3.8.2)
py
Runtime Error
24
9116
189
n = int(input()) l = list(map(int,input().split())) l.sort(reverse=True) ans = 1 num = sum(l) for i in range(0,n-1): num -= l[i] if num*2<l[i]: break ans += 1 print(ans)
s013495275
p03785
u749614185
1593391423
Python
Python (3.8.2)
py
Runtime Error
79
20064
245
import sys N, C, K = map(int, input().split()) A = list(map(int, sys.stdin.readlines()))+[10**10] A.sort() a, c, t = 0, 1, a[0]+k for i in A[1:]: if i <= t and c < C: c += 1 else: t, c = i + K, 1 a += 1 print(a)
s328308324
p03785
u112007848
1592592508
Python
Python (3.8.2)
py
Runtime Error
1593
144504
443
import bisect kyaku, teiin, jikan = map(int, input().split(" ")) a=sorted([(int)(input()) for i in range(kyaku)]) print(a) count = 0 while(True): print(a) if len(a) > teiin: if a[0] + jikan >= a[teiin]: a = a[teiin:] else: a = a[bisect.bisect_left(a, a[0] + jikan):] else: if a[0] + jikan >...
s971922093
p03785
u810787773
1591672541
Python
Python (3.4.3)
py
Runtime Error
242
7416
1938
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) if C == 1: return(N) if C == 2: while True: if T[j] + K >= T[i+1]: i = i...
s660476605
p03785
u810787773
1591672160
Python
Python (3.4.3)
py
Runtime Error
253
7412
1824
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) if C == 1: return(N) if C == 2: while True: if T[j] + K >= T[i+1]: i = i...
s623007047
p03785
u810787773
1591671930
Python
Python (3.4.3)
py
Runtime Error
249
7412
1826
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) if C == 1: return(N) if C == 2: while True: if T[j] + K >= T[i+1]: i = i...
s264497530
p03785
u810787773
1591671066
Python
Python (3.4.3)
py
Runtime Error
244
7412
1302
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) while True: if T[j] + K >= T[i+1]: i = i + 1 if i == N-1: ans += 1 ...
s002343163
p03785
u810787773
1591671043
Python
Python (3.4.3)
py
Runtime Error
243
7412
1303
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) while True: if T[j] + K >= T[i+1]: i = i + 1 if i == N-1: ans += 1 ...
s660909208
p03785
u810787773
1591670830
Python
Python (3.4.3)
py
Runtime Error
239
7520
1182
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) while True: if T[j] + K >= T[i+1]: i = i + 1 if i == N-1: ans += 1 ...
s843803206
p03785
u810787773
1591670334
Python
Python (3.4.3)
py
Runtime Error
244
7512
1079
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() if len(T) == 1: ans = 1 return(ans) while True: if T[j] + K >= T[i+1]: i = i + 1 if i == N-1: ans += 1 ...
s922412180
p03785
u810787773
1591670267
Python
Python (3.4.3)
py
Runtime Error
249
7512
1023
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 T.sort() while True: if T[j] + K >= T[i+1]: i = i + 1 if i == N-1: ans += 1 return (ans) for h in range(C-2): ...
s046187001
p03785
u810787773
1591669979
Python
Python (3.4.3)
py
Runtime Error
202
7072
1009
def main(): N, C, K = map(int, input().split()) T = [int(input()) for _ in range(N)] ans = 0 i = 0 j = 0 while True: if T[j] + K >= T[i+1]: i = i + 1 if i == N-1: ans += 1 return (ans) for h in range(C-2): ...
s971544944
p03785
u346395915
1590848610
Python
Python (3.4.3)
py
Runtime Error
21
3828
767
n, c, k = map(int, input().split()) check = [0] * (n+10) for i in range(n): check[int(input())] += 1 wait = False time_cnt = 0 people_cnt = 0 ans = 0 for i in range(len(check)): if wait == False: if check[i] > 0: wait = True people_cnt += check[i] time_cnt = 1 ...
s283041800
p03785
u346395915
1590848335
Python
PyPy3 (2.4.0)
py
Runtime Error
501
50008
786
n, c, k = map(int, input().split()) t = [int(input()) for _ in range(n)] check = [0] * (n+10) for i in t: check[i] += 1 wait = False time_cnt = 0 people_cnt = 0 ans = 0 for i in range(len(check)): if wait == False: if check[i] > 0: wait = True people_cnt += check[i] ...
s550248133
p03785
u346395915
1590847955
Python
Python (3.4.3)
py
Runtime Error
174
7836
786
n, c, k = map(int, input().split()) t = [int(input()) for _ in range(n)] check = [0] * (n+10) for i in t: check[i] += 1 wait = False time_cnt = 0 people_cnt = 0 ans = 0 for i in range(len(check)): if wait == False: if check[i] > 0: wait = True people_cnt += check[i] ...
s543842657
p03785
u314089899
1590714896
Python
Python (3.4.3)
py
Runtime Error
17
2940
695
from collections import deque N,C,K = map(int, input().split()) T_list = list() #左がもっとも早く着いた人 for i in range(N): T = int(input()) T_list.append(T) T_list.sort(reverse=False) waiting_deque = deque(T_list) ans = 0 while 1: if len(waiting_deque) != 0: ans += 1 bus_passenger = list() ...
s675644348
p03785
u230117534
1590548343
Python
Python (3.4.3)
py
Runtime Error
288
8280
445
N, C, K = map(int, input().strip().split(" ")) t = sorted([int(input().strip()) for _ in range(N)]) bus = 0 idx = 0 while idx < N: bus_go = t[idx] + K tmp = 0 while idx < N: if t[idx] <= bus_go: tmp += 1 idx += 1 if tmp == C: bus += 1 ...
s313897116
p03785
u858670323
1590233981
Python
Python (3.4.3)
py
Runtime Error
184
7072
309
n,c,k = map(int,input().split()) t = [] for i in range(n): t.append(int(input())) sort(t) ans = 0 now = 0 ter = -1 for i in range(n): if ter < t[i]+k: ans+=1 ter = t[i]+k now = 1 else: if(c>=now): ans+=1 ter = t[i]+k now = 1 else: now += 1 print(ans)
s597581617
p03785
u001769145
1590121988
Python
Python (3.4.3)
py
Runtime Error
611
8120
464
# AGC011 A Airport Bus import bisect from collections import deque n, c, k = map(int, input().split()) t_list = [int(input()) for _ in range(n)] t_list.sort() t_list = deque(t_list) ans = 0 while len(t_list) > 0: _tmp = t_list.popleft() + k _idx = bisect.bisect_right(t_list, _tmp) if c <= _idx + 1: ...
s624663961
p03785
u940139461
1589833930
Python
PyPy3 (2.4.0)
py
Runtime Error
541
50520
487
# https://atcoder.jp/contests/agc011/tasks/agc011_a n, c, k = map(int, input().split()) schedule = [] for _ in range(n): t = int(input()) schedule.append(t) schedule.sort() ans = 0 start = schedule[0] p = 0 for i in range(n): s = schedule[i] if s <= start + k: p += 1 if p == c: ...
s052263143
p03785
u940139461
1589833435
Python
PyPy3 (2.4.0)
py
Runtime Error
589
51032
916
# https://atcoder.jp/contests/agc011/tasks/agc011_a n, c, k = map(int, input().split()) schedule = [] for _ in range(n): t = int(input()) schedule.append(t) schedule.sort() # schedule.append(float('inf')) def check(num, schedule, c, k): bus = 0 start = schedule[0] p = 0 i = 0 while i < le...
s298920299
p03785
u711238850
1589718978
Python
PyPy3 (2.4.0)
py
Runtime Error
512
50264
399
from math import ceil N,C,K = map(int,input().split()) T = [int(input()) for _ in range(N)] T.sort() bus = 0 bus_time = T[0] + K tmp_bus = 1 for i in range(1,N): if T[i] > bus_time: bus += 1 bus_time = T[i+1] + K tmp_bus = 0 else: tmp_bus += 1 if tmp_bus == C: ...
s172422973
p03785
u869917163
1589667043
Python
Python (3.4.3)
py
Runtime Error
17
2940
280
N,C,K = map(int,input().split()) A = [] for _ in range(N): A.append(int(input())) A.sort() A0 = A[0] lis = [] cnt = 0 for i,name enumerate(A): if name <= A0 + K and len(lis) < C: lis.append(name) if len(lis) == C or i == N: lis.clear() cnt += 1 print(cnt)
s872984921
p03785
u487594898
1589477576
Python
Python (3.4.3)
py
Runtime Error
18
3064
427
input = sys.stdin.readline n,c,k = map(int,input().split()) A = [int(input()) for i in range(n)] a = sorted(A) ans = 0 time = 0.1 num = 0 for i in range(n): if ans == 0: ans +=1 time = a[0] -0.1 num +=1 elif ans != 0 and a[i] < time +k and num < c : num +=1 elif ans != 0 an...
s808761309
p03785
u321035578
1588853734
Python
Python (3.4.3)
py
Runtime Error
313
7744
717
from collections import deque n,c,k = map(int,input().split()) t = [] for _ in range(n): tt = int(input()) t.append(tt) t.sort() ans = deque([]) cnt = 0 for i, tt in enumerate(t): if i == 0: ans.append([tt+k,1]) cnt += 1 else: flg = False for i in range(len(ans)): ...
s944553736
p03785
u549161102
1588505580
Python
Python (3.4.3)
py
Runtime Error
17
2940
496
N,C,K = map(int, input().split()) T = [] for i in range(N): S.append(input()) S.sort() st = 0 fi = 1 count = 0 for i in range(N): a = S[i] if S[i] == while S[fi]-S[st] <= K and fi-st-1 <= C: fi += 1 else: count += 1 st = fi + 1 fi = fi + 1 print(count) N,C,K = map(int, input().split()) T = [int(input...
s747302864
p03785
u411203878
1587556623
Python
PyPy3 (2.4.0)
py
Runtime Error
513
50776
421
n,c,k = map(int,input().split()) ab = [] for _ in range(n): t=int(input()) ab.append(t) ab.sort() bus = 1 bustime = ab[0] + k customer = 1 for i in range(1,n): if ab[i] <= bustime: customer += 1 if customer == c: bustime = ab[i+i]+k customer = 0 bus += 1...
s400511725
p03785
u479638406
1586361065
Python
Python (3.4.3)
py
Runtime Error
2104
8344
335
import copy n, c, k = map(int, input().split()) t = [int(i) for i in range(n)] t.sort() s = copy.copy(t) ans = 0 for i in range(n): cnt = 1 for j in range(i+1, n): if t[j] - t[i] <= k: cnt += 1 t.remove(t[j]) if cnt == c: ans += 1 break else: ans += 1 break ...