Skip to content

Commit ca50f68

Browse files
committed
Add a test for ABC054-C
1 parent 15bf3d9 commit ca50f68

File tree

6 files changed

+72
-1
lines changed

6 files changed

+72
-1
lines changed

examples/abc054-c.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
use petgraph::csr::Csr;
2+
use petgraph::Undirected;
3+
4+
fn main() {
5+
// use std::io::{self, Read as _};
6+
//
7+
// let mut input = "".to_owned();
8+
// io::stdin().read_to_string(&mut input).unwrap();
9+
// let mut input = input.split_whitespace();
10+
// macro_rules! read {
11+
// ([$t:tt; $n:expr]) => {
12+
// (0..$n).map(|_| read!($t)).collect::<Vec<_>>()
13+
// };
14+
// (($($t:tt),+)) => {
15+
// ($(read!($t)),*)
16+
// };
17+
// (_1based) => {
18+
// read!(usize) - 1
19+
// };
20+
// (_bytes) => {
21+
// read!(String).into_bytes()
22+
// };
23+
// ($ty:ty) => {
24+
// input.next().unwrap().parse::<$ty>().unwrap()
25+
// };
26+
// }
27+
//
28+
// let (n, m) = read!((usize, usize));
29+
// let mut abs = read!([(_1based, _1based); m]);
30+
31+
use proconio::input;
32+
use proconio::marker::Usize1;
33+
34+
input! {
35+
n: usize,
36+
m: usize,
37+
mut abs: [(Usize1, Usize1); m],
38+
}
39+
40+
abs.sort();
41+
let mut g = Csr::<(), (), Undirected, usize>::with_nodes(n);
42+
for (a, b) in abs {
43+
g.add_edge(a, b, ());
44+
}
45+
let mut ans = 0;
46+
let mut es = (0..n).collect::<Vec<_>>();
47+
permutohedron::heap_recursive(&mut es, |es| {
48+
if es[0] == 0 && es.windows(2).all(|w| g.contains_edge(w[0], w[1])) {
49+
ans += 1;
50+
}
51+
});
52+
println!("{}", ans);
53+
}

examples/tests.ron

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131
name: "ABC049 / ARC065: C - 白昼夢 / Daydream",
3232
matching: ExactWords,
3333
),
34+
"abc054-c": (
35+
name: "ABC045: C - One-stroke Path",
36+
matching: ExactWords,
37+
),
3438
"abc120-d": (
35-
name: "ABC120: D - Decayed Bridges ",
39+
name: "ABC120: D - Decayed Bridges",
3640
matching: ExactWords,
3741
),
3842
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3 3
2+
1 2
3+
1 3
4+
2 3
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
7 7
2+
1 3
3+
2 7
4+
3 4
5+
4 5
6+
4 6
7+
5 6
8+
6 7
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy