Skip to content

Instantly share code, notes, and snippets.

@whatalnk whatalnk/abc080-d.rb
Created Sep 26, 2018

Embed
What would you like to do?
AtCoder ABC #080 D Recording
n, c = gets.chomp.split(" ").map(&:to_i)
N_MAX = 10**5
rs = Array.new(c + 1){Array.new(N_MAX*2 + 2, 0)}
n.times do
si, ti, ci = gets.chomp.split(" ").map(&:to_i)
(si*2 - 1).upto(ti*2) do |i|
rs[ci][i] = 1
end
end
ans = Array.new(N_MAX*2 + 2, 0)
rs.each do |r|
(N_MAX*2 + 2).times do |i|
ans[i] += r[i]
end
end
puts ans.max
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.