procon_lib_rs

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub CoCo-Japan-pan/procon_lib_rs

:heavy_check_mark: verify/AOJ/dsl_2d_dual_seg/src/main.rs

Depends on

Code

// verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_D

use algebra::Action;
use dual_segtree::DualSegTree;
use proconio::{fastout, input};

#[derive(Debug, Clone, PartialEq, Eq, Copy)]
pub struct RUQ {
    time_stamp: usize,
    value: u32,
}

impl algebra::Action for RUQ {
    type Target = Self;
    fn id_action() -> Self {
        Self {
            time_stamp: 0,
            value: (1_u32 << 31) - 1,
        }
    }
    fn composition(&mut self, rhs: &Self) {
        if self.time_stamp < rhs.time_stamp {
            *self = *rhs;
        }
    }
    fn apply(&self, target: &mut Self::Target) {
        if self.time_stamp > target.time_stamp {
            *target = *self;
        }
    }
}

impl algebra::Commutative for RUQ {}

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
    }
    let mut seg = DualSegTree::<RUQ>::new(n);
    for time_stamp in 1..=q {
        input! {
            query_type: u32,
        }
        if query_type == 0 {
            input! {
                s: usize,
                t: usize,
                x: u32,
            }
            let map = RUQ {
                time_stamp,
                value: x,
            };
            seg.apply_range_commutative(s..=t, &map);
        } else {
            input! {
                i: usize,
            }
            let composed = seg.get_composition(i);
            let mut target = RUQ::id_action();
            composed.apply(&mut target);
            println!("{}", target.value);
        }
    }
}
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/rust.py", line 288, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page