aizu_online_judge/dsl/
dsl_5_a.rs1use competitive::prelude::*;
2
3#[verify::aizu_online_judge("DSL_5_A")]
4pub fn dsl_5_a(reader: impl Read, mut writer: impl Write) {
5 let s = read_all_unchecked(reader);
6 let mut scanner = Scanner::new(&s);
7 scan!(scanner, n, t, lr: [(usize, usize)]);
8 let mut acc = vec![0; t + 1];
9 for (l, r) in lr.take(n) {
10 acc[l] += 1;
11 acc[r] -= 1;
12 }
13 for i in 0..t {
14 acc[i + 1] += acc[i];
15 }
16 writeln!(writer, "{}", acc.into_iter().max().unwrap_or_default()).ok();
17}