Submission #1676186


Source Code Expand

N = gets.to_i
a = gets.split(" ").map(&:to_i)
a = a.sort.reverse
all_sum = a.inject(&:+)
n = 1
a.each do |b|
  all_sum -= b
  if all_sum * 2 >= b
    n += 1
  else
    break
  end
end

puts n

Submission Info

Submission Time
Task B - Colorful Creatures
User gen6033
Language Ruby (2.3.3)
Score 400
Code Size 207 Byte
Status AC
Exec Time 81 ms
Memory 10112 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 19
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
in1.txt AC 81 ms 10096 KB
in10.txt AC 32 ms 4804 KB
in11.txt AC 74 ms 9856 KB
in12.txt AC 70 ms 10104 KB
in13.txt AC 71 ms 10100 KB
in2.txt AC 80 ms 9984 KB
in3.txt AC 81 ms 10096 KB
in4.txt AC 81 ms 10112 KB
in5.txt AC 34 ms 4820 KB
in6.txt AC 67 ms 9600 KB
in7.txt AC 80 ms 9984 KB
in8.txt AC 67 ms 9472 KB
in9.txt AC 15 ms 2680 KB
sample1.txt AC 7 ms 1788 KB
sample2.txt AC 7 ms 1788 KB
sample3.txt AC 7 ms 1788 KB