Created
March 19, 2018 05:05
-
-
Save whatalnk/8ce81d3e71aa6cf17dc26a7e8001f934 to your computer and use it in GitHub Desktop.
AtCoder ABC #089
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
a, b, c = gets.chomp.split(" ").map(&:to_i) | |
if a + b >= c then | |
puts "Yes" | |
else | |
puts "No" | |
end | |
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
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 |
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 | |
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