Submission #1958685


Source Code Expand

N,C = $stdin.gets.chomp.split(" ").map{ |a| a.to_i }
sticks = (0...N).map{ $stdin.gets.chomp.to_i }.sort

#p sticks

ans = 0
while sticks.size > 0 do
  l = sticks.pop
  if sticks[0] && sticks[0]+l+1 <= C
    sticks.shift
  end
  ans += 1
end
puts ans

Submission Info

Submission Time
Task C - 収納
User Corvvs
Language Ruby (2.3.3)
Score 300
Code Size 265 Byte
Status AC
Exec Time 92 ms
Memory 4656 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 16
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt AC 92 ms 4216 KB
02.txt AC 91 ms 4216 KB
03.txt AC 85 ms 4216 KB
04.txt AC 90 ms 4216 KB
05.txt AC 81 ms 4656 KB
06.txt AC 74 ms 4080 KB
07.txt AC 75 ms 4520 KB
08.txt AC 87 ms 4528 KB
09.txt AC 88 ms 4216 KB
10.txt AC 74 ms 4080 KB
11.txt AC 90 ms 4528 KB
12.txt AC 92 ms 4656 KB
13.txt AC 83 ms 4216 KB
sample_01.txt AC 7 ms 1788 KB
sample_02.txt AC 7 ms 1788 KB
sample_03.txt AC 7 ms 1788 KB