Skip to content

Commit 02e21ec

Browse files
committed
Add an example for ABC142-C
1 parent dc9129d commit 02e21ec

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

examples/abc142-c.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// https://atcoder.jp/contests/abc142/tasks/abc142_c
2+
3+
use itertools::Itertools as _;
4+
use superslice::Ext2 as _;
5+
6+
use std::io::{self, Read};
7+
8+
fn main() {
9+
let mut input = read_to_static(io::stdin()).split_whitespace();
10+
macro_rules! read {
11+
([$tt:tt]) => (read!([$tt; read!(usize)]));
12+
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
13+
(($($tt:tt),+)) => (($(read!($tt)),*));
14+
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
15+
({ Isize1 }) => {
16+
read!(isize) - 1
17+
};
18+
}
19+
20+
let mut a = read!([{ Isize1 }]);
21+
a.invert_permutation();
22+
println!("{}", a.iter().map(|a| a + 1).format(" "));
23+
}
24+
25+
fn read_to_static(mut source: impl Read) -> &'static str {
26+
let mut input = "".to_owned();
27+
source.read_to_string(&mut input).unwrap();
28+
Box::leak(input.into_boxed_str())
29+
}

test-with-generated-opts.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ url = "https://atcoder.jp/contests/abc141/tasks/abc141_c"
105105
matching = "Words"
106106
meta = { using = ["proconio"] }
107107

108+
[examples.abc142-c]
109+
name = "ABC142: C - Go to School"
110+
url = "https://atcoder.jp/contests/abc142/tasks/abc142_c"
111+
matching = "Words"
112+
meta = { using = ["itertools", "superslice"] }
113+
108114
[examples.abc142-d]
109115
name = "ABC142: D - Disjoint Set of Common Divisors"
110116
url = "https://atcoder.jp/contests/abc142/tasks/abc142_d"

0 commit comments

Comments
 (0)