// #[allow(unused_macros)] // macro_rules! input { // (@read $io:tt @rest) => {}; // (@read $io:tt @rest mut $($rest:tt)*) => { // input!(@read $io @mut [mut] @rest $($rest)*) // }; // (@read $io:tt @rest $($rest:tt)*) => { // input!(@read $io @mut [] @rest $($rest)*) // }; // (@read $io:tt @mut [$($mut:tt)?] @rest $var:tt: $($rest:tt)*) => { // input!(@read $io @mut[$($mut)*] @var $var @kind [] @rest $($rest)*) // }; // (@read $io:tt @mut [$($mut:tt)?] @var $var:tt @kind [$($kind:tt)*] @rest) => { // let $($mut)* $var = input!(@kind $io:tt $($kind)*); // }; // (@read $io:tt @mut [$($mut:tt)?] @var $var:tt @kind [$($kind:tt)*] @rest, $($rest:tt)*) => { // input!(@read $io @mut [$($mut)*] @var $var @kind [$($kind)*] @rest); // input!(@read $io @rest $($rest)*); // }; // (@read $io:tt @mut [$($mut:tt)?] @var $var:tt @kind [$($kind:tt)*] @rest $tt:tt $($rest:tt)*) => { // input!(@read $io @mut [$($mut)*] @var $var @kind [$($kind)* $tt] @rest $($rest)*); // }; // (@kind $io:tt [$kind:tt; $len:tt]) => { // io.scan_vec::<$kind>($len); // }; // (@kind $io:tt $kind:tt) => { // io.scan::<$kind>(); // }; // ($($rest:tt)*) => { // let mut io = IO::new(); // input!(@read io @rest $($rest)*) // }; // } fn main() { // input!{ // n: usize, _m: usize, k: i32, // ed: [(usize, usize); _m], // } let mut io = IO::new(); let (n, _m, k) = io.scan(); let ed = io.scan_vec::<(usize, usize)>(_m); let mut d = vec![vec![k+1; n]; n]; for i in 0..n { d[i][i] = 0; } for &(u, v) in &ed { d[u-1][v-1] = 1; d[v-1][u-1] = 1; } for v in 0..n { for u in 0..n { for w in 0..n { d[u][w] = std::cmp::min(d[u][w], d[u][v] + d[v][w]); } } } let mut vis = Vec::new(); for i in (1..n).rev() { vis.push(i); let m = vis.len(); let mut dp = vec![vec![k+1; m]; 1< k { continue; } for jj in 0..m { if bit & (1 << jj) == 0 { dp[bit | 1 << jj][jj] = std::cmp::min( dp[bit | 1 << jj][jj], dp[bit][j] + d[vis[j]][vis[jj]] ); } } } } let goal = (1 << m) - 1; if (0..m).all(|j| dp[goal][j] > k) { vis.pop(); } } println!("{}", vis.iter().map(|i| (1i64 << i) - 1).sum::()); } // ------------ io module start ------------ use std::io::{stdout, BufWriter, Read, StdoutLock, Write}; pub struct IO { iter: std::str::SplitAsciiWhitespace<'static>, buf: BufWriter>, } impl IO { pub fn new() -> Self { let mut input = String::new(); std::io::stdin().read_to_string(&mut input).unwrap(); let input = Box::leak(input.into_boxed_str()); let out = Box::new(stdout()); IO { iter: input.split_ascii_whitespace(), buf: BufWriter::new(Box::leak(out).lock()), } } fn scan_str(&mut self) -> &'static str { self.iter.next().unwrap() } fn scan_raw(&mut self) -> &'static [u8] { self.scan_str().as_bytes() } pub fn scan(&mut self) -> T { T::scan(self) } pub fn scan_vec(&mut self, n: usize) -> Vec { (0..n).map(|_| self.scan()).collect() } } impl IO { pub fn print(&mut self, x: T) { T::print(self, x); } pub fn println(&mut self, x: T) { self.print(x); self.print("\n"); } pub fn iterln>(&mut self, mut iter: I, delim: &str) { if let Some(v) = iter.next() { self.print(v); for v in iter { self.print(delim); self.print(v); } } self.print("\n"); } pub fn flush(&mut self) { self.buf.flush().unwrap(); } } impl Default for IO { fn default() -> Self { Self::new() } } pub trait Scan { fn scan(io: &mut IO) -> Self; } macro_rules! impl_parse_int { ($($t:tt),*) => { $( impl Scan for $t { fn scan(s: &mut IO) -> Self { let mut res = 0; let mut neg = false; for d in s.scan_raw() { if *d == b'-' { neg = true; } else { res *= 10; res += (*d - b'0') as $t; } } if neg { res = res.wrapping_neg(); } res } } )* }; } impl_parse_int!(i16, i32, i64, isize, u16, u32, u64, usize); impl Scan for (T, U) { fn scan(s: &mut IO) -> Self { (T::scan(s), U::scan(s)) } } impl Scan for (T, U, V) { fn scan(s: &mut IO) -> Self { (T::scan(s), U::scan(s), V::scan(s)) } } impl Scan for (T, U, V, W) { fn scan(s: &mut IO) -> Self { (T::scan(s), U::scan(s), V::scan(s), W::scan(s)) } } pub trait Print { fn print(w: &mut IO, x: Self); } macro_rules! impl_print_int { ($($t:ty),*) => { $( impl Print for $t { fn print(w: &mut IO, x: Self) { w.buf.write_all(x.to_string().as_bytes()).unwrap(); } } )* }; } impl_print_int!(i16, i32, i64, isize, u16, u32, u64, usize); impl Print for u8 { fn print(w: &mut IO, x: Self) { w.buf.write_all(&[x]).unwrap(); } } impl Print for &[u8] { fn print(w: &mut IO, x: Self) { w.buf.write_all(x).unwrap(); } } impl Print for &str { fn print(w: &mut IO, x: Self) { w.print(x.as_bytes()); } } impl Print for (T, U) { fn print(w: &mut IO, (x, y): Self) { w.print(x); w.print(" "); w.print(y); } } impl Print for (T, U, V) { fn print(w: &mut IO, (x, y, z): Self) { w.print(x); w.print(" "); w.print(y); w.print(" "); w.print(z); } } // ------------ io module end ------------