Created
April 14, 2019 04:24
-
-
Save whatalnk/e7b915e6a3289369bc47f260de7e9ba1 to your computer and use it in GitHub Desktop.
Codeforces #551 Div2 A - Serval and Bus
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, t = gets.chomp.split(" ").map(&:to_i) | |
ret = 10**5 | |
ans = -1 | |
n.times do |i| | |
s, d = gets.chomp.split(" ").map(&:to_i) | |
while true | |
if s >= t | |
st = s - t | |
if ret > st | |
ret = st | |
ans = i + 1 | |
end | |
break | |
end | |
s += d | |
end | |
end | |
puts ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment