aizu_online_judge/dsl/
dsl_3_d.rs

1use competitive::prelude::*;
2#[doc(no_inline)]
3pub use competitive::{algebra::MinOperation, data_structure::QueueAggregation};
4
5#[verify::aizu_online_judge("DSL_3_D")]
6pub fn dsl_3_d(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, l, a: [u64]);
10    let mut que = QueueAggregation::<MinOperation<_>>::new();
11    let mut ans = Vec::with_capacity(n - l + 1);
12    for a in a.take(n) {
13        que.push(a);
14        if que.len() == l {
15            ans.push(que.fold_all());
16            que.pop();
17        }
18    }
19    iter_print!(writer, @it ans);
20}