problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p03254 | s551620402 | Wrong Answer | N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]
lst.sort()
cnt = 0
for i in range(0,N):
if x >= lst[i]:
x -= lst[i]
cnt += 1
else:
break
print(cnt) |
p03254 | s339386317 | Wrong Answer | from itertools import accumulate
from bisect import bisect_right
N, x, *A = map(int, open(0).read().split())
A.sort()
S = list(accumulate(A))
if S[-1] == x:
print(N)
else:
k = bisect_right(A, x)
print(N - 1 if k == N else k) |
p03254 | s712695175 | Wrong Answer | n,x = map(int,input().split())
line = sorted(list(map(int,input().split())))
count = 0
if sum(line) < x:
count = n - 1
elif sum(line) == x:
count = n
else:
for i in range(n):
left = x - line[i]
if left > 0:
count += 1
else:
break
print(count)
|
p03254 | s331459610 | Wrong Answer | from itertools import accumulate
import bisect
N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
A = list(accumulate(A))
ind = bisect.bisect_right(A,x)-1
if ind == -1:
print(0)
else:
print(ind+1)
|
p03254 | s172097864 | Wrong Answer |
def myAnswer(N:int,x:int,A:list) -> int:
if(sum(A)==x): return N
A.sort()
counter = 0
for n,a in enumerate(A):
if(a <= x):
x -= a
counter += 1
else:
break
if(x != 0 and counter != 0 ):
counter -=1
return counter
def modelAnswer():
tmp=1
def main():
N,x = map(int,input().split())
A = list(map(int,input().split()))
print(myAnswer(N,x,A[:]))
if __name__ == '__main__':
main() |
p03254 | s652388448 | Wrong Answer | def candy(arr, n, x):
if sum(arr) == x:
return n
best = 0
j = 0
while(j < n):
c = 0
for i in range(j, n-1):
if arr[i] < x:
c += 1
x -= arr[i]
elif arr[i] == x:
c += 1
break
best = max(best, c)
j += 1
if arr[n-1] == x:
best += 1
return best
n, x = map(int, input().split())
arr = list(map(int, input().split()))
print(candy(arr, n, x)) |
p03254 | s133093988 | Wrong Answer | # AGC 027 A
N,X =map(int,input().split())
A =[int(j) for j in input().split()]
A.sort()
cnt=0
for a in A:
if X - a >=0:
X-=a
cnt+=1
print(cnt) |
p03254 | s081529027 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for v in a:
if v <= x and x >= 0:
count +=1
x -= v
if x != 0:
count = count - 1
print(count)
|
p03254 | s275519792 | Wrong Answer | N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
child = 0
candy = 0
print(a)
for i in a:
candy += i
if candy <= x:
child += 1
if sum(a) < x:
child -= 1
print(int(child)) |
p03254 | s289740166 | Wrong Answer | n,x = map(int,input().split())
a = sorted(map(int,input().split()))
c=0
for i in a:
if i<=x:
x-=i
c+=1
else:
if x>0:
c-=1
print(c) |
p03254 | s206672632 | Wrong Answer | N, x = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
for i in range(N):
if x < a[i]:
break
x -= a[i]
if x < 0:
break
ans += 1
if x > 0:
ans -= 1
print(max(ans, 0)) |
p03254 | s980050187 | Wrong Answer | n, x = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
for (i, v) in enumerate(arr):
if x >= v:
x -= v
ans += 1
if i == len(arr) - 1 and x > 0:
if not ans == 0:
ans -= 1
break
print(ans) |
p03254 | s409055201 | Wrong Answer | N,x=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)==x:
print(N)
exit()
else:
a.sort()
ans=0
flag=False
i=0
while i<N:
if x-a[i]>=0:
flag=True
x=x-a[i]
ans+=1
i+=1
if flag==False:
print(0)
exit()
print(ans if x==0 else ans-1)
|
p03254 | s085875769 | Wrong Answer | n,x= map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in range(n):
if 0 <= x-a[i]:
x = x-a[i]
ans +=1
print(ans)
|
p03254 | s053676820 | Wrong Answer | n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
i=0
if sum(a)<=x:
print(n)
exit()
elif min(a)>x:
print(0)
exit()
else:
while s<x:
s+=a[i]
i+=1
print(i-1)
|
p03254 | s606432154 | Wrong Answer | N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]
children.sort()
cnt = 0
for i in children:
if x - i < 0:
break
elif i == children[N - 1] and x - i > 0:
print(N - 1)
else:
x -= i
cnt += 1
print(cnt)
|
p03254 | s532689482 | Wrong Answer | n, x = map(int, input().split())
l = sorted(list(map(int, input().split())))
if sum(l) <= x:
print(n)
else:
for i in range(n):
print(x)
if x <= 0:
break
x -= l[i]
print(i+1) |
p03254 | s491616355 | Wrong Answer |
n,x= map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans= 0
X=x
for i in range(n):
if 0 < X-a[i]:
X = X-a[i]
ans +=1
elif X ==0:
break
if X >0 :
ans -=1
print(ans) |
p03254 | s661496079 | Wrong Answer | N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]
lst.sort(reverse = True)
cnt = 0
for i in range(0,N):
if x >= lst[i]:
cnt += 1
else:
break
print(cnt)
|
p03254 | s527645608 | Wrong Answer | n, x = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
i = 0
while True:
x -= a.pop()
ans += 1
i += 1
if x == 0:
break
elif len(a) == 0 or i == n:
ans -= 1
break
print(ans)
|
p03254 | s682690951 | Wrong Answer | N, x = map(int, input().split())
a = sorted(map(int, input().split()))
count=0
for i in range(N):
if x>=a[i]:
x=x-a[i]
count+=1
print(count) |
p03254 | s766753986 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if sum(a) ==x:
print(n)
else:
a.sort()
for i in range(n):
if x >= a[i]:
ans += 1
x -= a[i]
else:
break
if x != 0:
ans -= 1
print(ans)
|
p03254 | s221384604 | Wrong Answer | n, x = map(int, input().split())
num_lists = list(map(int, input().split()))
num_lists.sort()
cnt = 0
for i in num_lists:
if i <= x:
cnt += 1
x -= i
else:
break
if num_lists[0] <= x:
cnt -= 1
print(cnt) |
p03254 | s402233884 | Wrong Answer | n,x=map(int,input().split())
ans=0
a=sorted(list(map(int,input().split())))
for i in range(n):
x-=a[i]
if x>=0:
ans+=1
print(ans) |
p03254 | s475614660 | Wrong Answer | n,x,*a=map(int, open(0).read().split())
a.sort()
for i in range(n):
x-=a[i]
if x<0:
print(i)
exit()
print(n) |
p03254 | s563332030 | Wrong Answer | n,x = map(int,input().split())
A = sorted(map(int,input().split()))
ans = 0
if x < A[0]:
print(0)
exit()
for i in range(n):
x -= A[i]
ans += 1
if x < 0:
ans -= 1
break
print(ans)
|
p03254 | s932589582 | Wrong Answer | N,x = list(map(int,input().split()))
A = list(map(int,input().split()))
count = 0
for a in A:
if x >= a:
x -= a
count += 1
if x > 0:
print(max(count-1,0))
else:
print(count) |
p03254 | s935465258 | Wrong Answer | n, x = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) < x:
x -= sum(A)
A.sort()
ans = n
for a in A:
if x - a >= 0:
x -= a
ans -= 1
# else:
# break
else:
A.sort(reverse=True)
ans = 0
for a in A:
if x - a >= 0:
x -= a
ans += 1
# else:
# break
print(ans) |
p03254 | s325598850 | Wrong Answer | N, X = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
if X >= A[i]:
X -= A[i]
ans += 1
print(ans) |
p03254 | s608637773 | Wrong Answer | import sys
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cnt_children = 0
for i in range(n):
if x >= a[i]:
cnt_children += 1
x -= a[i]
if x > 0 and cnt_children != 0:
cnt_children -= 1
print("{}".format(cnt_children)) |
p03254 | s678626544 | Wrong Answer | n, x = map(int, input().split())
num_list = list(map(int, input().split()))
ans = 0
num_list.sort()
for num in num_list:
if x - num >= 0:
x -= num
ans += 1
else:
break
print(ans)
|
p03254 | s158140415 | Wrong Answer | N,X = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
m = sum(a)
count = 0
S=0
if m == X:
print(N)
elif m < X:
print(N-1)
elif a[0] > X:
print(0)
else:
for i in a:
if S < X:
S = S + i
count = count + 1
else:
print(count) |
p03254 | s058517555 | Wrong Answer | n,x= map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
s = 0
for i in range(n):
s += a[i]
if s > x:
i -= 1
break
print(i+1) |
p03254 | s480343254 | Wrong Answer | N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
if x < min(A):
print(cnt)
break
elif i == N-1:
print(N)
else:
x -= min(A)
A.remove(min(A))
cnt += 1
|
p03254 | s033948939 | Wrong Answer | n,x = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
cnt=0
for i,X in enumerate(a):
if x>=X:
cnt+=1
x-=X
else:
break
if cnt>0 and x>0:
cnt-=1
print(cnt) |
p03254 | s092682062 | Wrong Answer | N, x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
cnt = 0
for a in al[:N]:
if x >= a:
x -= a
cnt += 1
else:
break
if al[-1] == x:
cnt += 1
print(cnt)
|
p03254 | s922897741 | Wrong Answer | N, X = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
cnt=0
for i in range(N):
if A[i]<=X:
X-=A[i]
cnt+=1
if X>0 and cnt>0:
cnt-=1
print(cnt)
|
p03254 | s698795904 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
a.sort()
for i in range(N):
if a[i]<=x:
x -= a[i]
cnt += 1
else:
break
if (x!=0)and(cnt!=0):
cnt -= 1
print(cnt) |
p03254 | s774350080 | Wrong Answer | # A - Candy Distribution Again
count = 0
N, x = map(int, input().split())
A = input().split()
A.sort()
for i in range(N):
if(x == 0):
break
if(i == N-1):
#最後なので全部あげる
if(x == int(A[i])):
count += 1
else:
x -= int(A[i])
if(x >= 0):
count += 1
print(count) |
p03254 | s387110511 | Wrong Answer | p_c,k_c=(int(x) for x in input().split())
al=list(map(int,input().split()))
al.sort(reverse=True)
count=0
for i in range(p_c):
if i==al.index(al[-1]):
k_c=k_c-al[i]
if k_c==0:
count+=1
else:
break
else:
k_c=k_c-al[i]
count+=1
print(count)
|
p03254 | s478705806 | Wrong Answer | N,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
flag=False
for i in a:
temp=x-i
if temp>=0:
flag=True
x-=i
ans+=1
if flag==False:
print(0)
exit()
print(ans if x==0 else ans-1)
|
p03254 | s575907573 | Wrong Answer | n,x = map(int, input().split())
line = list(map(int, input().split()))
line.sort()
ans = 0
for i in range(n):
x -= line[i]
if x < 0:
break
else:
ans += 1
print(ans) |
p03254 | s707495889 | Wrong Answer | N, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
ans = 0
for i in a:
if x >= i:
ans += 1
x -= i
else:
break
print(ans) |
p03254 | s555136668 | Wrong Answer | n, x = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
for consume_v in arr:
if x >= consume_v:
x -= consume_v
ans += 1
else:
break
if x > 0:
if ans != 0:
ans -= 1
print(ans) |
p03254 | s109549512 | Wrong Answer | N,x=map(int,input().split())
a=list(map(int,input().split()))
if sum(a)==x:
print(N)
exit()
else:
a.sort()
ans=0
flag=False
for i in a:
temp=x-i
if temp>=0:
flag=True
x-=i
ans+=1
if flag==False:
print(0)
exit()
print(ans if x==0 else ans-1)
|
p03254 | s786970643 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
cnt = 0
for i in range(n):
if i==n-1:
if x-a[i]!=0:
pass
else:
cnt+=1
elif x-a[i]>=0:
x -= a[i]
cnt += 1
else:
pass
print(cnt) |
p03254 | s153778764 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for ai in a:
if ai <= x:
x -= ai
count += 1
else:
break
# 全員に配り終えても余っている場合は、残りのクッキーを1人にわたす
if count == N and x > 0:
count =- 1
print(count) |
p03254 | s136054304 | Wrong Answer | n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
i=0
if sum(a)<x:
print(n)
exit()
elif min(a)>x:
print(0)
exit()
else:
while s<x:
s+=a[i]
i+=1
print(i)
|
p03254 | s335010515 | Wrong Answer | n, x = map(int, input().split())
li_a = list(map(int, input().split()))
answer = 0
for a in sorted(li_a):
if x >= a:
answer += 1
x -= a
else:
break
print(answer if (x == 0 or answer == 0) else answer - 1)
|
p03254 | s682557600 | Wrong Answer | n,x,*a=map(int, open(0).read().split())
a.sort()
i=0
while 0<x and i<n:
x-=a[i]
i+=1
print(~-i) |
p03254 | s125114477 | Wrong Answer | if __name__ == "__main__":
n, x = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) == x:
print(n)
exit()
a.sort()
ans = 0
tmp = 0
for aa in a:
if tmp < x and aa <= x-tmp:
tmp += aa
ans += 1
if tmp == x:
print(ans)
exit()
if x-tmp > 0:
ans -= 1
print(ans)
|
p03254 | s373438488 | Wrong Answer | n, x = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
for consume_v in arr:
if x > consume_v:
x -= consume_v
ans += 1
elif x == consume_v:
x -= consume_v
ans += 1
else:
break
if x > 0:
if ans != 0:
ans -= 1
print(ans) |
p03254 | s608113890 | Wrong Answer | n, x = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
for i in arr:
print(ans)
x -= i
if x < 0:
break
else:
ans += 1
if x > 0 and ans > 0:
ans -= 1
print(ans) |
p03254 | s934133365 | Wrong Answer | try:
N, x = map(int, input().split())
a = map(int, input().split())
a_ = sorted(a)
cnt = 0
for i in a_:
if i<=x:
cnt += 1
x = x-i
else:
break
print(cnt)
except EOFError:
pass |
p03254 | s773318207 | Wrong Answer | N,x = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
ans = 0
for i in range(N):
if A[i] > x :
print(ans)
break
else:
x -= A[i]
ans += 1
if i == N-1:
print(N-1)
break
|
p03254 | s053911540 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
for i in a:
if x >= i:
cnt += 1
x -= i
if x > 0:
cnt -= 1
if cnt < 0:
cnt = 0
print(cnt) |
p03254 | s514862839 | Wrong Answer | n, x, *a = map(int, open(0).read().split())
a.sort()
cnt = 0
for i in range(n):
if x >= a[i]:
x -= a[i]
cnt += 1
print(a,x,cnt)
else:
break
if x > 0:
cnt -= 1
print(max(cnt,0))
|
p03254 | s990647288 | Wrong Answer | def solve(n, x, A):
A.sort()
count = 0
for a in A:
if a <= x:
x -= a
count += 1
else:
break
return count
_n, _x = list(map(int, input().split()))
_A = list(map(int, input().split()))
print(solve(_n, _x, _A))
|
p03254 | s807641424 | Wrong Answer | N,x = map(int,input().split())
# a=[int(input()) for i in range(4)]
a = list(map(int,input().split()))
count = 0
#昇順に並べ替える
sort_a = sorted(a)
for i in range(N):
print(i)
if x >= sort_a[i]:
count += 1
x -= sort_a[i]
# print(x)
continue
break
print(count) |
p03254 | s212910330 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
A = sorted(a)
n = 0
for i in A:
x -= i
n += 1
if x==0:
print(n)
break
elif x<0:
print(n-1)
break
elif i == A[N-1]:
print(n-1)
break |
p03254 | s542235897 | Wrong Answer | N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
#print(N, x)
A.sort()
#print(A)
cnt = 0
if x >= sum(A):
cnt -= 1
for a in A:
if x >= a:
x -= a
cnt += 1
else:
break
print(cnt)
|
p03254 | s325168075 | Wrong Answer | n,x = map(int,input().split())
l = sorted(list(map(int,input().split())))
ans = 0
for i in l:
if i <= x:
x -= i
ans += 1
print(ans) |
p03254 | s773158382 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for i in a:
if x >= i:
x -= i
count += 1
else:
pass
if x > 0:
count -= 1
print(count) |
p03254 | s934485924 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
count = 0
resid = x
for i in range(N):
if a[i] <=resid:
count += 1
resid -= a[i]
else:
break
if resid > 0:
count -= 1
print(max(count,0)) |
p03254 | s534397567 | Wrong Answer | n, x = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
for i in range(n):
if x >= a[i]:
x -= a[i]
ans += 1
print(ans - (x > 0))
|
p03254 | s355221369 | Wrong Answer | N, x = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
sum = 0
A.sort()
for i in range(N):
sum += A[i]
if sum <= x:
ans += 1
else:
break
print(ans)
|
p03254 | s726985317 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
a.sort()
for i in range(N):
if a[i]<=x:
x -= a[i]
cnt += 1
else:
break
print(cnt) |
p03254 | s307991947 | Wrong Answer | #!/usr/bin/env python
n, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
if x < a[0]:
print(0)
exit()
cnt = 0
for i in range(n):
if x >= a[i]:
x -= a[i]
cnt += 1
if x > 0:
ans = cnt-1
else:
ans = cnt
print(ans)
|
p03254 | s263502030 | Wrong Answer | N , X = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A = [0] + A
for i in range(N):
A[i+1] = A[i]+A[i+1]
if A[i+1]>X:
print(i)
exit()
print(N)
|
p03254 | s590609897 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for i in a:
if x-i>=0:
x -= i
count += 1
elif x-i<=0:
break
print(count-1)
|
p03254 | s693295644 | Wrong Answer | N, x = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for i in range(len(A)):
if x < min(A):
print(cnt)
break
else:
x -= min(A)
cnt += 1
print(cnt+1) |
p03254 | s986197831 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
# 小さい数から配っていくと子供の人数を最大化できる
a = sorted(a)
leftCandy = 0
childrenCnt = 0
for i in range(len(a)):
leftCandy = x - a[i]
if leftCandy >= 0:
childrenCnt += 1
if leftCandy > 0:
childrenCnt -= 1
print(childrenCnt)
|
p03254 | s007160845 | Wrong Answer | n, x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
count = 0
for i in a:
if x - i >= 0:
x -= i
count += 1
else:
break
if x != 0:
count -= 1 if count > 0 else 0
print(count) |
p03254 | s585600392 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
for i in range(len(a)):
if x - a[i] >= 0:
x -= a[i]
count += 1
else:
break
print(count) |
p03254 | s012643172 | Wrong Answer | N, x = map(int, input().split())
array = list(map(int, input().split()))
array = sorted(array, reverse=False)
#print(array)
for i in range (N):
if sum(array) < x:
print(N)
break
elif sum(array[0:i+1]) == x:
print(i)
break
elif sum(array[0:i+1]) < x and x < sum(array[0:i]):
print(i-1)
break
else:
pass |
p03254 | s564901697 | Wrong Answer | N,M = map(int,input().split())
L = map(int,input().split())
L = sorted(L)
total = 0
i = 0
for i in range(N):
if M - int(L[0]) > 0:
M -= int(L[0])
total += 1
L.pop(0)
i += 1
print(total) |
p03254 | s609842849 | Wrong Answer | N,x=input().split()
X=int(x)
n=int(N)
y=0
A = [int(i) for i in input().split()]
A.sort()
for z in range(n):
y+=A[z]
if y>=X:
print(z+1)
break
else:
print(N) |
p03254 | s530366211 | Wrong Answer | n, x = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
i = 0
while True:
an = a.pop()
x -= an
ans += 1
i += 1
if len(a) == 0 or i == n:
break
if x == 0:
ans += 1
print(ans - 1)
|
p03254 | s024618353 | Wrong Answer | N,x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
count = 0
for i in range(N):
b = x - A[i]
if b > 0:
count += 1
x -= A[i]
else:
exit()
print(count) |
p03254 | s093308533 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
s = x
cnt = 0
if sum(a) > s:
print(N-1)
elif s >= a[0]:
for i in range(N):
if s >= a[i]:
cnt += 1
s -= a[i]
print(cnt) |
p03254 | s315836436 | Wrong Answer | N, x = [int(x) for x in input().strip().split()]
an = sorted([int(a) for a in input().strip().split()])
cumsum = 0
for i, a in enumerate(an, start=1):
cumsum += a
if cumsum > x:
break
print(i-1) |
p03254 | s819619556 | Wrong Answer | from itertools import accumulate
N, x, *A = map(int, open(0).read().split())
A.sort()
B = list(accumulate(A)) # cumsum
def f(B, x):
ans = 0
for b in B:
ans += 1
if x == b:
break
elif x < b:
ans -= 1
break
return ans
if B[-1] < x:
x -= B[-1]
ans = len(A) - f(B, x)
else:
ans = f(B, x)
print(ans) |
p03254 | s950810173 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
i = 0
for i in a:
if i > x:
break
else:
x -= i
ans += 1
if x != 0:
ans -= 1
print(ans)
|
p03254 | s942903402 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in range(n):
if x >= a[i]:
ans += 1
x -= a[i]
else:
break
if x>0:
ans-=1
if ans < 0:
ans =0
print(ans) |
p03254 | s902748274 | Wrong Answer | a,b=map(int,input().split())
c=list(map(int,input().split()))
c.sort()
i=0
total=0
while True:
if b>=c[i]:
b=b-c[i]
total+=1
else:
print(total)
break |
p03254 | s855244569 | Wrong Answer | N, x = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort()
ans = []
for i in A:
ans.append(i)
x -= i
#print(ans, x)
if x <= 0:
break
print(len(ans)) |
p03254 | s487448227 | Wrong Answer | n, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
for a in A:
if x - a >= 0:
x -= a
ans += 1
if 0 < x:
ans -= 1
print(max(ans, 0)) |
p03254 | s637755003 | Wrong Answer | N, x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
cnt = 0
for a in al:
x -= a
cnt += 1
if x < 0:
break
print(cnt)
|
p03254 | s405691430 | Wrong Answer | n, x=map(int, input().split())
c=list(map(int, input().split()))
c.sort()
ans=0
for g in c:
if g<=x:
x-=g
ans+=1
else:
break
if x>0:
print(0)
else:
print(ans) |
p03254 | s430796110 | Wrong Answer | N, x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
f=0
i=0
while x>=a[i]:
x=x-a[i]
i=i+1
f=f+1
if i==N:
break
if x>0:
print(f-1)
else:
print(f) |
p03254 | s691327722 | Wrong Answer | # 27 --- > dbt
# try 1
n, x = map(int, input().split())
a = list(map(int, input().split()))
num = 0
left = 0
for i in range(len(a)-1):
if x >= a[i] :
num += 1
x -= a[i]
else:
left += a[i]
if num == (n-1) and x == a[-1]:
num += 1
elif num != (n-1) and x >= a[-1]:
num += 1
print(num) |
p03254 | s330620835 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
cnt = 0
for i in range(n):
if i == n - 1:
if x == a[i]:
cnt += 1
elif x >= a[i]:
x -= a[i]
cnt += 1
print(cnt)
|
p03254 | s240609105 | Wrong Answer | n,x = map(int,input().split())
A = sorted(map(int,input().split()))
ans = 0
for i in range(n):
x -= A[i]
ans += 1
if x < 0:
ans -= 1
break
print(ans)
|
p03254 | s267739493 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=False)
count = 0
for i in range(N):
if x>=a[i]:
count += 1
x -= a[i]
else:
break
print(count) |
p03254 | s984453316 | Wrong Answer | n,x = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
cnt = 0
tank = 0
for i in range(n):
if tank+A[i] <= x:
tank += A[i]
cnt += 1
else:
break
print(cnt if tank==x else max(cnt-1, 0)) |
p03254 | s993303861 | Wrong Answer | n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
c,i=0,0
while(i<n and x>0):
if a[i]<=x:
x-=a[i]
c+=1
i+=1
else:
break
print(c) |
p03254 | s849831624 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 0
while i < n:
x -= a[i]
if (x < 0):
break
i += 1
print(i) |
p03254 | s012660300 | Wrong Answer |
from itertools import accumulate
def LI():
return list(map(int, input().split()))
N, x = LI()
a = LI()
a.sort()
Asum = list(accumulate(a))
ans = 0
if Asum[N-1] == x:
ans = N
elif Asum[N-1] < x:
ans = N-1
elif Asum[0] > x:
ans = 0
else:
for i in range(N):
if Asum[i] <= x:
ans += 1
else:
if Asum[i-1] != x:
ans -= 1
break
print(ans)
|
p03254 | s748835893 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
A = sorted(a)
n = 0
for i in A:
x -= i
n += 1
if x==0:
print(n)
break
elif x<0:
print(n-1)
break
elif i == A[N-1]:
print(n-1)
|
p03254 | s459406950 | Wrong Answer | from itertools import accumulate
n, x, *aa = map(int, open(0).read().split())
aa.sort()
aa = list(accumulate(aa))
print(max(len([a for a in aa if a<=x])-1+(x in aa), 0)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.