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

:warning: verify/AtCoder/abc328f/src/main.rs

Depends on

Code

//! https://atcoder.jp/contests/abc328/tasks/abc328_f

use algebra::{Commutative, Group, Monoid};
use itertools::Itertools;
use potentialized_unionfind::PotentializedUnionFind;
use proconio::{fastout, input, marker::Usize1};

#[derive(Debug)]
struct AddGroup {}
impl Monoid for AddGroup {
    type Target = i64;
    fn binary_operation(a: &Self::Target, b: &Self::Target) -> Self::Target {
        a + b
    }
    fn id_element() -> Self::Target {
        0
    }
}
impl Group for AddGroup {
    fn inverse(a: &Self::Target) -> Self::Target {
        -a
    }
}
impl Commutative for AddGroup {}

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        a_b_d: [(Usize1, Usize1, i64); q],
    }
    let mut uf = PotentializedUnionFind::<AddGroup>::new(n);
    let mut ans = Vec::with_capacity(n);
    for (i, (a, b, d)) in a_b_d.into_iter().enumerate() {
        if uf.relate(a, b, d).is_ok() {
            ans.push(i + 1);
        }
    }
    println!("{}", ans.iter().format(" "));
}
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