Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Codeforces #336 Div2
# [Problem - A - Codeforces](
n, s = gets.chomp.split(" ").map(&:to_i)
psgs =
n.times do
psgs << gets.chomp.split(" ").map(&:to_i)
psgs = psgs.sort_by{|x| x[0]}.reverse
res = 0
current = s
psgs.each do |f, t|
res += current - f
current = f
if res < t then
res = t
if current != 0 then
res += current
puts res

This comment has been minimized.

Copy link
Owner Author

commented Dec 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.