結果
問題 | No.8078 Very Simple Traveling Salesman Problem |
ユーザー |
|
提出日時 | 2021-04-01 22:04:58 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 1,546 bytes |
コンパイル時間 | 13,051 ms |
コンパイル使用メモリ | 402,588 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 06:23:27 |
合計ジャッジ時間 | 14,276 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 |
コンパイルメッセージ
warning: unused imports: `max`, `min`
--> src/main.rs:60:16
|
60 | use std::cmp::{max, min};
| ^^^ ^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused variable: `es`
--> src/main.rs:73:9
|
73 | es: [(i64, i64, i64); m],
| ^^
|
help: `es` is captured in macro and introduced a unused variable
--> src/main.rs:33:13
|
33 | let sc, $t);
| ^^^^
...
70 | / input! {
71 | | sc,
72 | | n: usize, m: usize,
73 | | es: [(i64, i64, i64); m],
74 | | }
| |_____- in this macro invocation
= note: `#[warn(unused_variables)]` on by default
= note: this warning originates in the macro `input_inner` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)
ソースコード
struct Scanner {bytes: std::io::Bytes<std::io::BufReader<std::io::Stdin>>,}impl Scanner {fn new() -> Self {Self {bytes: std::io::Read::bytes(std::io::BufReader::new(std::io::stdin())),}}fn next(&mut self) -> String {self.bytes.by_ref().map(|r| r.unwrap() as char).skip_while(|c| c.is_whitespace()).take_while(|c| !c.is_whitespace()).collect()}}macro_rules! input {($sc:expr, $($r:tt)*) => {input_inner!{$sc, $($r)*}};}macro_rules! input_inner {($sc:expr) => {};($sc:expr, ) => {};($sc:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($sc, $t);input_inner!{$sc $($r)*}};}macro_rules! read_value {($sc:expr, ( $($t:tt),* )) => {( $(read_value!($sc, $t)),* )};($sc:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($sc, $t)).collect::<Vec<_>>()};($sc:expr, Chars) => {read_value!($sc, String).chars().collect::<Vec<char>>()};($sc:expr, Usize1) => {read_value!($sc, usize) - 1};($sc:expr, $t:ty) => {$sc.next().parse::<$t>().expect("Parse error")};}use std::cmp::{max, min};fn main() {let mut sc = Scanner::new();let ans = solve(&mut sc);println!("{}", ans);}fn solve(sc: &mut Scanner) -> usize {input! {sc,n: usize, m: usize,es: [(i64, i64, i64); m],}n}