提出 #31565577
ソースコード 拡げる
n, x = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
answer = 0
for a_i in a:
if x >= a_i:
answer += 1
x -= a_i
if (answer == n) and (x > 0):
answer = n - 1
print(answer)
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Candy Distribution Again |
| ユーザ | Pro_ktmr |
| 言語 | PyPy3 (7.3.0) |
| 得点 | 200 |
| コード長 | 234 Byte |
| 結果 | AC |
| 実行時間 | 64 ms |
| メモリ | 61712 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
| All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 0_00.txt | AC | 64 ms | 61712 KiB |
| 0_01.txt | AC | 48 ms | 61308 KiB |
| 0_02.txt | AC | 53 ms | 61568 KiB |
| 0_03.txt | AC | 50 ms | 61700 KiB |
| 1_00.txt | AC | 52 ms | 61688 KiB |
| 1_01.txt | AC | 52 ms | 61648 KiB |
| 1_02.txt | AC | 52 ms | 61560 KiB |
| 1_03.txt | AC | 51 ms | 61668 KiB |
| 1_04.txt | AC | 53 ms | 61656 KiB |
| 1_05.txt | AC | 52 ms | 61452 KiB |
| 1_06.txt | AC | 50 ms | 61560 KiB |
| 1_07.txt | AC | 57 ms | 61512 KiB |