Skip to content

Commit 208e5ea

Browse files
committed
Add a test for ABC054-C
1 parent 4551db2 commit 208e5ea

File tree

6 files changed

+74
-1
lines changed

6 files changed

+74
-1
lines changed

examples/abc054-c.rs

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

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