結果
問題 | No.1880 Many Ways |
ユーザー | akakimidori |
提出日時 | 2022-03-18 22:25:10 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,428 bytes |
コンパイル時間 | 10,789 ms |
コンパイル使用メモリ | 401,348 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 07:16:39 |
合計ジャッジ時間 | 22,879 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 2 ms
6,820 KB |
testcase_02 | AC | 1 ms
6,820 KB |
testcase_03 | AC | 1 ms
6,820 KB |
testcase_04 | AC | 1 ms
6,816 KB |
testcase_05 | AC | 1 ms
6,820 KB |
testcase_06 | AC | 1 ms
6,816 KB |
testcase_07 | AC | 1 ms
6,816 KB |
testcase_08 | AC | 1 ms
6,816 KB |
testcase_09 | AC | 1 ms
6,820 KB |
testcase_10 | AC | 1 ms
6,820 KB |
testcase_11 | AC | 1 ms
6,816 KB |
testcase_12 | AC | 1 ms
6,816 KB |
testcase_13 | AC | 1 ms
6,816 KB |
コンパイルメッセージ
warning: unused import: `std::io::Write` --> src/main.rs:51:5 | 51 | use std::io::Write; | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused variable: `i` --> src/main.rs:73:9 | 73 | for i in 1..=40 { | ^ help: if this is intentional, prefix it with an underscore: `_i` | = note: `#[warn(unused_variables)]` on by default warning: type alias `Map` is never used --> src/main.rs:54:6 | 54 | type Map<K, V> = BTreeMap<K, V>; | ^^^ | = note: `#[warn(dead_code)]` on by default warning: type alias `Set` is never used --> src/main.rs:55:6 | 55 | type Set<T> = BTreeSet<T>; | ^^^ warning: type alias `Deque` is never used --> src/main.rs:56:6 | 56 | type Deque<T> = VecDeque<T>; | ^^^^^
ソースコード
// ---------- begin input macro ---------- // reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); s }; let mut iter = s.split_whitespace(); input_inner!{iter, $($r)*} }; } macro_rules! input_inner { ($iter:expr) => {}; ($iter:expr, ) => {}; ($iter:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($iter, $t); input_inner!{$iter $($r)*} }; } macro_rules! read_value { ($iter:expr, ( $($t:tt),* )) => { ( $(read_value!($iter, $t)),* ) }; ($iter:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::<Vec<char>>() }; ($iter:expr, bytes) => { read_value!($iter, String).bytes().collect::<Vec<u8>>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } // ---------- end input macro ---------- use std::io::Write; use std::collections::*; type Map<K, V> = BTreeMap<K, V>; type Set<T> = BTreeSet<T>; type Deque<T> = VecDeque<T>; fn run() { input! { a: usize, } let mut v = 1; let mut gen = || { let res = v; v += 1; res }; let src = 0; let mut e = vec![]; let mut x = vec![]; let mut y = vec![]; let mut z = vec![]; for i in 1..=40 { x.push(gen()); y.push(gen()); z.push(gen()); } let dst = z[z.len() - 1]; e.push((src, x[0])); e.push((src, y[0])); for i in 1..x.len() { e.push((x[i - 1], x[i])); e.push((x[i - 1], y[i])); e.push((y[i - 1], x[i])); e.push((y[i - 1], y[i])); e.push((z[i - 1], z[i])); } for i in 0..40 { if a >> i & 1 == 1 { e.push((x[i], z[i])); } } println!("{} {}", dst + 1, e.len()); for (a, b) in e { println!("{} {}", a + 1, b + 1); } } fn main() { run(); }