aizu_online_judge/dsl/
dsl_2_f.rs1use competitive::prelude::*;
2#[doc(no_inline)]
3pub use competitive::{algebra::RangeMinRangeUpdate, data_structure::LazySegmentTree};
4
5#[verify::aizu_online_judge("DSL_2_F")]
6pub fn dsl_2_f(reader: impl Read, mut writer: impl Write) {
7 let s = read_all_unchecked(reader);
8 let mut scanner = Scanner::new(&s);
9 scan!(scanner, n, q);
10 let mut seg = LazySegmentTree::<RangeMinRangeUpdate<_>>::new(n);
11 for _ in 0..q {
12 match scanner.scan::<usize>() {
13 0 => {
14 scan!(scanner, s, t, x: i32);
15 seg.update(s..t + 1, Some(x));
16 }
17 1 => {
18 scan!(scanner, s, t);
19 writeln!(writer, "{}", seg.fold(s..t + 1)).ok();
20 }
21 _ => panic!("unknown query"),
22 }
23 }
24}