Submission #3199992
Source Code Expand
N, X, *AS = $stdin.read.split.map(&:to_i)
acc = X
AS.sort.each.with_index(1){|a, i|
acc -= a
if acc < 0
p i-1; exit
elsif acc == 0
p i; exit
end
}
p N-1
Submission Info
| Submission Time | |
|---|---|
| Task | A - Candy Distribution Again |
| User | yhara |
| Language | Ruby (2.3.3) |
| Score | 200 |
| Code Size | 180 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 1788 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 | 7 ms | 1788 KiB |
| 0_01.txt | AC | 7 ms | 1788 KiB |
| 0_02.txt | AC | 7 ms | 1788 KiB |
| 0_03.txt | AC | 7 ms | 1788 KiB |
| 1_00.txt | AC | 7 ms | 1788 KiB |
| 1_01.txt | AC | 7 ms | 1788 KiB |
| 1_02.txt | AC | 7 ms | 1788 KiB |
| 1_03.txt | AC | 7 ms | 1788 KiB |
| 1_04.txt | AC | 7 ms | 1788 KiB |
| 1_05.txt | AC | 7 ms | 1788 KiB |
| 1_06.txt | AC | 7 ms | 1788 KiB |
| 1_07.txt | AC | 7 ms | 1788 KiB |