problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p03254 | s047133076 | Wrong Answer | N,x=map(int,input().split())
A=list(map(int,input().split()))
A_1=sorted(A)
num=0
total=0
if A[0]>x:
num=0
if sum(A_1)>=x:
for i in range(N):
total+=A_1[i]
if total==x:
num+=1
break
elif total>x:
num-=1
break
else:
num+=1
else:
num=N-1
print(num)
|
p03254 | s792654229 | 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:
break
print(n-1) |
p03254 | s715349184 | Wrong Answer | #22
N,x = map(int,input().split())
a = list(map(int,input().split()))
cou =0
a.sort()
for i in a:
if i >x:
break
cou +=1
x -= i
if x>0:
for i in a:
if x%i ==0:
cou -=1
break
while x > i:
x-=i
cou -= 1
print(cou)
|
p03254 | s898774228 | Wrong Answer | n,x = map(int,input().split())
line = sorted(list(map(int,input().split())))
count = 0
if sum(line) < x:
count = n - 1
else:
for i in range(n):
left = x - line[i]
if left > 0:
count += 1
elif left == 0:
count += 1
break
else:
count -= 1
break
if count < 0:
count = 0
print(count) |
p03254 | s427721211 | Wrong Answer | n,x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
c = 0
for a in al:
if x >= a:
c += 1
x -= a
print(c) |
p03254 | s716275366 | Wrong Answer | def main():
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(N):
x -= a[i]
if x < 0:
break
ans = i
print(ans)
if __name__ == "__main__":
main()
|
p03254 | s360281616 | Wrong Answer | n,x = map(int,input().split())
a_inputs = sorted([int(i) for i in input().split()])
ans=0
while a_inputs:
if a_inputs[0]>x:
break
else:
a = a_inputs.pop(0)
x-=a
ans+=1
if x!=0 and ans!=0:
ans-=1
print(ans)
|
p03254 | s388331591 | Wrong Answer | N, x = map(int, input().split())
A = sorted(map(int, input().split()))
if sum(A) == x:
print(N)
else:
c = 0
for ai in A:
x -= ai
if x <= 0:
break
c += 1
print(c + 1 if x == 0 else c) |
p03254 | s577991162 | Wrong Answer | n, x = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
i = 0
while n > i:
an = a.pop()
if x > an:
x -= an
ans += 1
elif x == an:
x -= an
ans += 1
break
elif x < an:
break
i += 1
if len(a) == 0:
break
if x > 0:
ans -= 1
print(ans)
|
p03254 | s514991184 | Wrong Answer | N, x = [int(a) for a in input().split()]
a = [int(a) for a in input().split()]
a = sorted(a)
sum_cost = 0
ans = 0
for v in a:
sum_cost += v
if sum_cost <= x:
ans += 1
else:
sum_cost -= v
break
if sum_cost != x:
ans -= 1
print(max(ans, 0)) |
p03254 | s976782821 | Wrong Answer |
N,x = map(int,input().split())
hito = input().split()
poo = [hito]
zyun = sorted(hito)
ok = 0
for i in range(len(hito)):
if x-int(zyun[i])>=0:
ok+=1
if ok == len(hito):
print(ok)
else:
print(ok)
|
p03254 | s249830430 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
cont = 0
for i in sorted(a):
x -= i
if x >= 0:
cont += 1
else:
break
if x != 0:
cont -= 1
print(cont) |
p03254 | s860091065 | Wrong Answer | from itertools import accumulate
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
c = accumulate(a)
ans = sum([1 for i in c if i <= x])
print(ans if x in c else ans - 1) |
p03254 | s900522334 | Wrong Answer | n,x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
c = 0
for a in al:
if x >= a:
c += 1
x -= a
if x > 0:
c -= 1
print(c) |
p03254 | s944105442 | Wrong Answer | N,x = map(int,input().split())
AAA = map(int,input().split())
AA = list(AAA)
AA.sort()
total = 0
count =0
for i in AA:
total += i
if total == x:
ans = N
elif total < x:
ans = N-1
else:
for i in AA:
if x >= i:
x -=1
count +=1
ans = count
print(ans)
|
p03254 | s817414604 | Wrong Answer | a,b=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
if sum(L)==b:
print(a)
exit()
for i in range(a):
if b-L[i]<0:
print(i)
exit()
print(i) |
p03254 | s918650646 | Wrong Answer | N, x = map(int, input().split())
A = sorted(list(map(int, input().split())))
S = 0
ans = 0
for a in A:
ans += 1
if S + a > x:
break
else:
S += a
print(ans-1)
|
p03254 | s070873109 | 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
elif i == len(A)-1:
print(cnt+1)
else:
x -= min(A)
A.remove(min(A))
cnt += 1
|
p03254 | s531008292 | Wrong Answer | N, X = map(int, input().split())
la = sorted(list(map(int, input().split())))
print(la)
if X < la[0]:
print(0)
elif X > sum(la):
print(N-1)
elif X == sum(la):
print(N)
else:
j = 0
while X > 0:
X = X - la[j]
j += 1
print(j) |
p03254 | s377953972 | 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
else:
i += 1
print(i-1) |
p03254 | s679847384 | Wrong Answer | N, x = [int(z) for z in input().split()]
children = [int(z) for z in input().split()]
children.sort()
sum = 0
for i in range(N):
sum += children[i]
if sum >= x:
print(i + 1)
break
|
p03254 | s762284449 | Wrong Answer | N,M = map(int,input().split())
L = map(int,input().split())
L = sorted(L)
total = 0
for i in range(N):
if M - int(L[0]) >= 0:
M -= int(L[0])
total += 1
L.pop(0)
print(total) |
p03254 | s938108732 | Wrong Answer | N,x = map(int,input().split())
A = list(map(int,input().split()))
X = 1
ans = 0
while x >= X:
ans += A.count(X)
x += -X*(A.count(X))
X += 1
if ans !=0 & x!=0:
ans += -1
print(ans) |
p03254 | s199919175 | Wrong Answer | N, X = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
cnt=0
i=0
A.append(X+1)
flag=0
while True:
if A[i]<=X:
X-=A[i]
cnt+=1
i+=1
flag=1
elif X==0:
break
else:
if flag==1:
cnt-=1
break
print(cnt)
|
p03254 | s985376891 | 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
print(childrenCnt) |
p03254 | s323290902 | 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
if count != n:
print(count)
else:
print(n-1)
|
p03254 | s752353514 | 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)
elif A[ind] == x:
print(ind+1)
else:
print(ind)
|
p03254 | s092328577 | Wrong Answer | N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
i = 0
while i<N and x>=A[i]:
x -= A[i]
i += 1
if x>0:
i -= 1
print(i) |
p03254 | s143656194 | Wrong Answer | n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort(key=int)
ans=0
for i in range(n):
x=x-a[i]
if x<0:
x=x+a[i]
else:
ans+=1
if ans==n:
if (x-sum(a))>0:
print(ans-1)
else:
print(ans)
else:
print(ans) |
p03254 | s837383748 | 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:
cnt += 1
x -= A[i]
else:
break
print(cnt if x==0 else cnt-1) |
p03254 | s177765010 | 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
elif k_c==0 or k_c<0:
break
else:
k_c=k_c-al[i]
count+=1
print(count)
|
p03254 | s753830572 | Wrong Answer | N,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
count=0
for i in range(N):
if x<a[i]:
break
else:
count+=1
x-=a[i]
print(count)
|
p03254 | s163639548 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
ans = 0
for i in range(n):
if a[i] <= x:
ans += 1
x -= a[i]
else:
break
if x > 0:
ans -= 1
print(ans) |
p03254 | s471920921 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
count = 0
for i in range(n):
if x:
x -= a[i]
else:
print(i)
exit()
print(n if x == 0 else n-1) |
p03254 | s572941368 | Wrong Answer | n, x, *aa = map(int, open(0).read().split())
aa.sort()
from itertools import accumulate
print(len([a for a in accumulate(aa) if a<=x])) |
p03254 | s221223222 | Wrong Answer | n, x = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])
ans = 0
for a in A:
if a <= x:
ans += 1
x -= a
else:
break
print(ans)
|
p03254 | s063380998 | Wrong Answer | N,x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
Sum = sum(A)
if x >= Sum:
print(N)
exit()
ans = 0
for i in range(N):
if x >= A[i]:
ans += 1
x -= A[i]
else:
print(ans)
break
else:
print(ans) |
p03254 | s274559770 | Wrong Answer | n,x=map(int,input().split())
a=sorted([int(i)for i in input().split()])
res=0
if sum(a)==x:
res=n
else:
for i in range(n):
if a[i]>x:
break
res+=1
x-=a[i]
if x!=0 and res!=0:
res-=1
print(res) |
p03254 | s979422549 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
count = 0
for i in range(n):
if a[i] <= x:
x -= a[i]
count += 1
else:
print(count)
break |
p03254 | s132289864 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
count = 0
#昇順に並べ替える
# sort_a = sorted(a)
a.sort(reverse=False)
for i in range(N):
if x >= a[i]:
count += 1
x -= a[i]
else:
break
print(count)
if (x!=0)and(count == N):
count -= 1
print(count) |
p03254 | s042231466 | 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):
if x <= l[i]:
break
x -= l[i]
print(i) |
p03254 | s991181771 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
while len(a) != 0:
next = min(a)
a.remove(min(a))
if x < next:
break
x -= next
cnt += 1
print(cnt if x == 0 else cnt-1) |
p03254 | s304887021 | Wrong Answer | #!/usr/bin/env python
n, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
if x == sum(a):
print(n)
exit()
if x > sum(a):
print(n-1)
exit()
if x < min(a):
print(0)
exit()
ans = 0
tmp = n
while tmp >= 0:
tmp -= a[ans]
ans += 1
print(ans)
|
p03254 | s998958776 | Wrong Answer | # A - Candy Distribution Again
N,x = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
tmp = 0
ans = 0
for a in A:
tmp += a
if tmp<=x:
ans += 1
else:
break
print(ans) |
p03254 | s345441717 | Wrong Answer | N,x=map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans=0
if sum(a)<x:
print(N-1)
else:
for i in range(len(a)):
if x>=a[i]:
x -= a[i]
ans += 1
else:
break
print(ans)
|
p03254 | s561535913 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
a.sort()
a_sum = [sum(a[:i+1]) for i in range(len(a))]
for i, item in enumerate(a_sum):
if x < item:
ans = i
break
elif x == item:
ans = i+1
elif x > item and i == len(a_sum):
ans = i-1
print(ans)
|
p03254 | s339810021 | 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:
count +=1
x -= v
if x != 0:
count = count - 1
print(count)
|
p03254 | s850829141 | 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
if x > 0:
count -= 1
print(count) |
p03254 | s774321031 | Wrong Answer | import sys
N, x = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
score_x = x
if score_x < a[0]:
print(0)
sys.exit()
for i in range(N):
if score_x >= a[i]:
score_x = (score_x - a[i])
ans = ans + 1
print(ans) |
p03254 | s506584637 | Wrong Answer | n,x=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
a.sort()
ans=n
s=0
for i in range(n):
if s>x:
ans=i
break
else:
s=s+a[i]
if s<x:
print(ans-1)
else:
print(ans) |
p03254 | s455801220 | Wrong Answer | n,x,*a=map(int, open(0).read().split())
a.sort()
i=0
while 0<x:
x-=a[i]
if i<~-n:i+=1
else:break
print(i) |
p03254 | s317190037 | Wrong Answer | N, x = map(int,input().split())
a = list(map(int,input().split()))
count = 0
a_new = sorted(a)
for i in range(0, N):
x -= a_new[i]
if x < 0:
index = i - 1
break
if x == 0:
index = i + 1
break
index = i
if index < 0:
index = 0
print(str(index)) |
p03254 | s416924001 | 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
print(count) |
p03254 | s256278931 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
sum = 0
ans = 0
for i in range(len(a)):
sum += a[i]
if x >= sum:
ans += 1
else:
break
print(ans)
|
p03254 | s855067434 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
candies = 0
over = 0
for i in a:
candies += i
if x < i:
over += 1
if candies == x: # 全員満足
print(N)
exit()
elif over == len(a): # 全員不満足
print(0)
exit()
elif candies < x:
print(N - 1)
exit()
else:
print(N - over)
exit() |
p03254 | s874240361 | Wrong Answer | N, x = map(int, input().split())
arr = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
if x >= arr[i]:
x -= arr[i]
ans += 1
else:
break
print(max(ans,0)) |
p03254 | s146001627 | Wrong Answer | N,x=map(int, input().split())
A=sorted(list(map(int, input().split())))
cnt=0
for i in A:
if i == A[-1] and x > i:
break
if x >= i:
x -= i
cnt+=1
else:
break
print(cnt)
|
p03254 | s563671136 | Wrong Answer | N, x = map(int, input().split())
list_a = [int(x) for x in input().split()]
list_a.sort()
total = sum(list_a)
if x < list_a[0] :
print(0)
exit()
ans = 0
for i in range(N) :
if list_a[i] <= x :
x -= list_a[i]
ans += 1
print(ans)
|
p03254 | s373175194 | Wrong Answer | N,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
count = 0
total = 0
for i in range(N):
if total <=x:
count += 1
total += a[i]
else:
break
if total < x:
count = N-1
print(count) |
p03254 | s315479653 | Wrong Answer | N,x=map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
a.sort()
for i in a:
if x >= i:
x -= i
cnt +=1
else:
print(cnt)
exit()
print(cnt) |
p03254 | s870997635 | Wrong Answer | N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
i = 0
while i<N and x>=A[i]:
x -= A[i]
i += 1
if x>0:
i -= 1
print(max(0,i)) |
p03254 | s918454632 | 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 A[ind] == x:
print(ind+1)
else:
print(ind) |
p03254 | s693621808 | 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 and ans != 0:
ans -= 1
'''
print(ans)
|
p03254 | s892625324 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
c = 0
for i in range(N):
if x >= a[i]:
x -= a[i]
c += 1
else:
break
if x > 0:
print(N-1)
else:
print(c) |
p03254 | s635362911 | Wrong Answer | N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
ans = 0
for i,a in enumerate(A):
x = x-a
if x<0:
break
elif i==len(A)-1:
if x!=a:
break
ans+=1
print(ans) |
p03254 | s205838584 | Wrong Answer | N,x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
print(A)
ans = 0
for i in range(N):
if x > A[i]:
ans += 1
x -= A[i]
elif x == A[i]:
print(ans+1)
break
else:
print(ans -1)
break
else:
print(ans-1)
|
p03254 | s954056552 | Wrong Answer | N,x=map(int,input().split())
A=sorted(list(map(int,input().split())),reverse=True)
cnt=0
for i in range(N-1):
if x-A[i]>=0:
cnt+=1
x-=A[i]
else:
break
if x-A[N-1]==0:
cnt+=1
print(cnt) |
p03254 | s110925210 | Wrong Answer | # https://atcoder.jp/contests/agc027/tasks/agc027_a
n, x = map(int, input().split())
nums = [int(i) for i in input().split()]
nums.sort()
if sum(nums) == x:
print(n)
else:
c = 0
for i in range(n):
if x >= nums[i]:
c += 1
x -= nums[i]
if x > 0:
print(max(0, c - 1))
else:
print(c) |
p03254 | s083395114 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
if sum(a) < x:
print(n-1)
elif sum(a) == x:
print(n)
else:
for i in a:
if x >= i:
cnt += 1
x -= i
print(cnt)
|
p03254 | s635726380 | Wrong Answer | N,x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(N):
x -= a[i]
if x <= 0:
print(i+1)
exit()
print(N) |
p03254 | s769718144 | 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):
if y>=X:
break
print(z+1)
y+=A[z]
if y>=X:
print(N)
else:
print(N) |
p03254 | s614476767 | Wrong Answer | n,x = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
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 | s005187895 | Wrong Answer | try:
N, x = map(int, input().split())
l = list(map(int, input().split()))
l_ = sorted(l)
cnt = 0
for i in l_:
_ = x-i
if _>= 0:
cnt += 1
if _<0:
break
print(cnt)
except EOFError:
pass |
p03254 | s651589055 | Wrong Answer | import sys
N, x = map(int, input().split())
a = sorted(map(int, input().split()))
ans = 0
score_x = x
if score_x < a[0]:
print(0)
sys.exit()
for i in range(N):
if i == (N-1):
if a[i] == score_x:
ans = ans + 1
else:
break
if score_x >= a[i]:
score_x = (score_x - a[i])
ans = ans + 1
print(ans) |
p03254 | s225285410 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cnt = 0
for i in a:
if x >= i:
x -= i
cnt += 1
else:
break
if x != 0 and cnt != 0:
cnt -= 1
print(cnt) |
p03254 | s750240705 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
while x > min(a):
for i in a:
if x >= i:
x -= i
count += 1
else:
pass
print(count) |
p03254 | s597794402 | 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) |
p03254 | s707919256 | Wrong Answer | n,x=map(int,input().split())
A=sorted(list(map(int,input().split())))
for i in range(n):
x-=A[i]
if x<0:
print(i)
break
else:print(n)
|
p03254 | s027478944 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
for i, a in enumerate(sorted(a_list), start=1):
x -= a
if x < 0:
break
if x >= 0:
print(i)
else:
print(i-1)
if __name__ == '__main__':
main() |
p03254 | s123729928 | 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
else:
x -= i
cnt += 1
print(cnt)
|
p03254 | s692436643 | 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:
x=x-a[i]
ans=ans+1
print(ans)
|
p03254 | s429398130 | 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(max(0, ans - (x > 0)))
|
p03254 | s639091621 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
a.sort()
a_sum = [sum(a[:i+1]) for i in range(len(a))]
for i, item in enumerate(a_sum):
if x < item:
ans = i
break
elif x == item:
ans = i+1
elif x > item and i == len(a_sum):
ans = i
print(ans)
|
p03254 | s859907211 | 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
print(count) |
p03254 | s511007700 | Wrong Answer | N,x = list(map(int,input().split()))
A = list(sorted(list(map(int,input().split()))))
for i in range(N,0,-1):
if sum(A[:i]) <= x:
print(i)
break
else:
print(0) |
p03254 | s052525359 | Wrong Answer | n, x = map(int, input().split())
a = list(map(int, input().split()))
l = sorted(a)
flag = False
for i in range(n):
x -= l[i]
if x < 0:
flag = True
break
if flag:
print(i)
else:
print(n) |
p03254 | s849336529 | Wrong Answer | N, x = map(int, input().split())
child_list = list(map(int, input().split()))
count = 0
for child in sorted(child_list):
x -= child
if x < 0:
break
count += 1
count = N if count >= N else count
print(count) |
p03254 | s002343276 | Wrong Answer | if __name__ == "__main__":
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
tmp = 0
for aa in a:
if tmp < x and aa <= x-tmp:
tmp += aa
ans += 1
if x-tmp > 0 and ans > 0:
ans -= 1
print(ans)
|
p03254 | s438778842 | 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:
ans += 1
x -= a[i]
else:
break
print(ans)
|
p03254 | s665087973 | Wrong Answer | n, x = map(int, input().split())
a_l = list(map(int, input().split()))
a_l = sorted(a_l)
ans = 0
for a in a_l:
x = x-a
if x < 0:
break
ans += 1
print(ans) |
p03254 | s361145258 | Wrong Answer | N, x = map(int, input().split())
a = map(int, input().split())
a = sorted(a)
re = x
i = 0
ans = 0
for i in range(N):
if a[i]<re:
re -= a[i]
ans += 1
else:
break
if ans==N and re>0:
ans -= 1
print(ans)
|
p03254 | s737393969 | Wrong Answer | n,x = map(int,input().split())
a_list = list(map(int,input().split()))
a_list.sort()
count = 0
for i in range(n):
if a_list[i] <= x:
count += 1
x = x-a_list[i]
else:
break
print(count) |
p03254 | s969282068 | 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):
if x <= 0:
break
x -= l[i]
print(i) |
p03254 | s523963322 | Wrong Answer | n, x = map(int, input().split())
nums = sorted(list(map(int, input().split())))
count = 0
for num in nums:
if (num <= x and num != nums[-1]) or (num == x and num == nums[-1]):
count += 1
x -= num
else:
break
print(count) |
p03254 | s548474191 | Wrong Answer | from typing import SupportsComplex
N, x = [int(a) for a in input().split()]
a = [int(a) for a in input().split()]
a = sorted(a)
result = []
for v in a:
if x >= v:
result.append(v)
x -= v
else:
break
if len(result) == 0:
print(0)
exit()
if x > 0:
result[-1] += x
if result[-1] != a[len(result)-1]:
ans = len(result)-1
else:
ans = len(result)
print(ans) |
p03254 | s010089788 | Wrong Answer | from itertools import accumulate
N, x, *A = map(int, open(0).read().split())
A.sort()
B = list(accumulate(A)) # cumsum
ans = 0
for i in range(len(B)):
ans = i
if x == B[i]:
ans += 1
break
elif x < B[i]:
ans -= 1
break
if ans < 0:
ans = 0
print(ans) |
p03254 | s980783846 | Wrong Answer | n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
num=0
for i in a:
ans+=1
num+=i
if num>x:
print(ans-1)
exit()
print(n) |
p03254 | s070163180 | Wrong Answer | N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
current = x
result = 0
for i in range(N):
if current >= a[i]:
current -= a[i]
result += 1
if current > 0 and result != 0:
result -= 1
print(result) |
p03254 | s897315754 | Wrong Answer | n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
s=0
while s<n:
if m>=a[s]:
m-=a[s]
s+=1
else:break
if m>0:#最後余った時
s-=1
print(s) |
p03254 | s394999274 | 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 and ans != 0:
ans -= 1
print(ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.