Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created March 19, 2018 05:05
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/8ce81d3e71aa6cf17dc26a7e8001f934 to your computer and use it in GitHub Desktop.
Save whatalnk/8ce81d3e71aa6cf17dc26a7e8001f934 to your computer and use it in GitHub Desktop.
AtCoder ABC #089
a, b, c = gets.chomp.split(" ").map(&:to_i)
if a + b >= c then
puts "Yes"
else
puts "No"
end
h = Hash.new(0)
n = gets.chomp.to_i
n.times do
word = gets.chomp
h[word] += 1
end
m = gets.chomp.to_i
m.times do
word = gets.chomp
h[word] -= 1
end
puts [0, h.values.max].max
n = gets.chomp.to_i
reds = []
blues = []
n.times do
reds << gets.chomp.split(" ").map(&:to_i)
end
n.times do
blues << gets.chomp.split(" ").map(&:to_i)
end
blues.sort_by!{|x| x[0]}
flags = Array.new(n, 0)
cands = []
blues.each do |blue|
red = [-1, -1]
flag = -1
n.times do |i|
if flags[i] == 0 && reds[i][0] < blue[0] && reds[i][1] < blue[1] then
if reds[i][1] > red[1] then
red = reds[i]
flag = i
end
end
end
if flag >= 0 then
flags[flag] = 1
end
end
puts flags.inject(:+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment