Created
October 21, 2017 15:00
-
-
Save whatalnk/13bf0923d358e63edded6e33178785ce to your computer and use it in GitHub Desktop.
AtCoder ARC #049 B - 高橋ノルム君
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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