Submission #31565577
Source Code Expand
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)
Submission Info
| Submission Time | |
|---|---|
| Task | A - Candy Distribution Again |
| User | Pro_ktmr |
| Language | PyPy3 (7.3.0) |
| Score | 200 |
| Code Size | 234 Byte |
| Status | AC |
| Exec Time | 64 ms |
| Memory | 61712 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 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 |