-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sample code for the practice contest #52
base: master
Are you sure you want to change the base?
Add sample code for the practice contest #52
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For convenience, how about adding it?
Thanks @matsu7874. Co-authored-by: Kentaro Matsumoto <[email protected]>
@matsu7874 Applied! |
Why not add an example for F? We've already implemented |
@qryxip I didn't just because it was not yet merged when I created this PR. I'l do it later. |
Examples do not affect language updates; triaged as low priority. |
For example, practice2_f might be implemented as follows. https://atcoder.jp/contests/practice2/submissions/40093355 // Check Problem Statement via https://atcoder.jp/contests/practice2/tasks/practice2_f
use ac_library_rs::{convolution, modint::ModInt998244353 as Mint};
use std::io::prelude::*;
pub fn main() {
let mut buf = String::new();
std::io::stdin().read_to_string(&mut buf).unwrap();
let mut input = buf.split_whitespace();
let n: usize = input.next().unwrap().parse().unwrap();
let m: usize = input.next().unwrap().parse().unwrap();
let a: Vec<Mint> = input
.by_ref()
.take(n)
.map(str::parse)
.map(Result::unwrap)
.collect();
let b: Vec<Mint> = input
.by_ref()
.take(m)
.map(str::parse)
.map(Result::unwrap)
.collect();
print_oneline(convolution::convolution(&a, &b));
}
fn print_oneline<I: IntoIterator<Item = T>, T: std::fmt::Display>(values: I) {
let out = std::io::stdout();
let mut out = std::io::BufWriter::new(out.lock());
for (i, v) in values.into_iter().enumerate() {
if i == 0 {
write!(&mut out, "{}", v).unwrap();
} else {
write!(&mut out, " {}", v).unwrap();
}
}
writeln!(&mut out).unwrap();
} |
Added all the sample code for AtCoder Library Practice Contest except for Convolution.
These examples may also be useful for expander checker.