Source

Displayed source is the repository entry file; the actual submission is preprocessed.

rust solutions/librarychecker-aplusb/aplusb/rust/src/main.rs Repository source
1// Library Checker A+B — uses the shared AddMonoid via `#[path]` import so
2// the solution page can surface `libraries/rust/algebra/monoid.rs` as a
3// direct dependency. `hooks/expand-libraries.sh` inlines the library at
4// submission time so the submitted single-file source still compiles on
5// the judge.
6
7mod libs;
8use libs::monoid::{AddMonoid, Monoid};
9
10use std::io::{self, BufRead, BufWriter, Write};
11
12fn main() {
13    let stdin = io::stdin();
14    let stdout = io::stdout();
15    let mut out = BufWriter::new(stdout.lock());
16    for line in stdin.lock().lines() {
17        let line = line.expect("read line");
18        let mut it = line.split_whitespace();
19        let (Some(a), Some(b)) = (it.next(), it.next()) else {
20            continue;
21        };
22        let a: i64 = a.parse().expect("parse a");
23        let b: i64 = b.parse().expect("parse b");
24        let acc = AddMonoid::op(&AddMonoid::op(&AddMonoid::id(), &a), &b);
25        writeln!(out, "{acc}").expect("write");
26    }
27}

Depends on

Verification

Verdict
Accepted
Judged
Execution
10 ms
Memory
648 KiB
OJ submission
Open
Testcase verdicts
NameVerdictTime (ms)Memory (KiB)
example_00AC0524
example_01AC0568
random_00AC10536
random_01AC0520
random_02AC0524
random_03AC0552
random_04AC0616
random_05AC0648
random_06AC0544
random_07AC0564
random_08AC0520
random_09AC1536

Diagnostics

No diagnostics.