rust
Source
Displayed source is the repository entry file; the actual submission is preprocessed.
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
- Monoid (Rust) rust
libraries/rust/algebra/monoid.rs
Verification
- Verdict
- Accepted
- Judged
- Execution
- 10 ms
- Memory
- 648 KiB
- OJ submission
- Open
| Name | Verdict | Time (ms) | Memory (KiB) |
|---|---|---|---|
example_00 | AC | 0 | 524 |
example_01 | AC | 0 | 568 |
random_00 | AC | 10 | 536 |
random_01 | AC | 0 | 520 |
random_02 | AC | 0 | 524 |
random_03 | AC | 0 | 552 |
random_04 | AC | 0 | 616 |
random_05 | AC | 0 | 648 |
random_06 | AC | 0 | 544 |
random_07 | AC | 0 | 564 |
random_08 | AC | 0 | 520 |
random_09 | AC | 1 | 536 |
Diagnostics
No diagnostics.