Submission #3199992


Source Code Expand

Copy
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
Exec Time 7 ms
Memory 1788 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 200 / 200 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 7 ms 1788 KB
0_01.txt 7 ms 1788 KB
0_02.txt 7 ms 1788 KB
0_03.txt 7 ms 1788 KB
1_00.txt 7 ms 1788 KB
1_01.txt 7 ms 1788 KB
1_02.txt 7 ms 1788 KB
1_03.txt 7 ms 1788 KB
1_04.txt 7 ms 1788 KB
1_05.txt 7 ms 1788 KB
1_06.txt 7 ms 1788 KB
1_07.txt 7 ms 1788 KB