Submission #2894201


Source Code Expand

n,a,b = gets.chomp.split(" ").map(&:to_i)
h = n.times.map{gets.to_i}
min = 1
max = h.inject(0){|r,i|r+(i+a-1)/a}
while min <= max
  mid = min+(max-min)/2
  ans = 0
  for i in 0..n-1
    ans += ([0,h[i]-b*mid].max+a-b-1)/(a-b)
  end
  if ans < mid
    max = mid-1
  elsif ans > mid
    min = mid+1
  else
    break
  end
end
puts mid

Submission Info

Submission Time
Task D - Widespread
User koikotya
Language Ruby (2.3.3)
Score 0
Code Size 350 Byte
Status WA
Exec Time 1843 ms
Memory 2996 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 12
WA × 1
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 7 ms 1788 KB
a02 AC 7 ms 1788 KB
a03 AC 7 ms 1788 KB
b04 AC 7 ms 1788 KB
b05 AC 757 ms 2684 KB
b06 AC 1840 ms 2996 KB
b07 AC 719 ms 2684 KB
b08 AC 757 ms 2684 KB
b09 AC 1843 ms 2684 KB
b10 WA 1691 ms 2684 KB
b11 AC 1401 ms 2684 KB
b12 AC 1139 ms 2996 KB
b13 AC 717 ms 2684 KB