Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created October 21, 2017 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/13bf0923d358e63edded6e33178785ce to your computer and use it in GitHub Desktop.
Save whatalnk/13bf0923d358e63edded6e33178785ce to your computer and use it in GitHub Desktop.
AtCoder ARC #049 B - 高橋ノルム君
N = gets.chomp.to_i
x = []
y = []
c = []
N.times do
x_, y_, c_ = gets.chomp.split(" ").map(&:to_f)
x << x_
y << y_
c << c_
end
low = 0.0
high = 10**8
mid = (low + high) / 2
(2<<6).times do
l = []
r = []
u = []
b = []
N.times do |i|
w = mid / c[i]
l << x[i] - w
r << x[i] + w
u << y[i] + w
b << y[i] - w
end
if l.max <= r.min && b.max <= u.min
high = mid
else
low = mid
end
mid = (low + high) / 2
end
puts mid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment