結果
問題 | No.5016 Worst Mayor |
ユーザー | shim0 |
提出日時 | 2023-04-29 15:46:05 |
言語 | Rust (1.77.0 + proconio) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,247 bytes |
コンパイル時間 | 1,680 ms |
コンパイル使用メモリ | 164,964 KB |
実行使用メモリ | 26,000 KB |
スコア | 0 |
最終ジャッジ日時 | 2023-04-29 15:46:15 |
合計ジャッジ時間 | 8,236 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
コンパイルメッセージ
warning: unused variable: `uv` --> Main.rs:57:13 | 57 | let uv: Vec<u32> = read_vec(); | ^^ help: if this is intentional, prefix it with an underscore: `_uv` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `t` --> Main.rs:56:25 | 56 | fn solve(&mut self, t: usize) { | ^ help: if this is intentional, prefix it with an underscore: `_t` warning: multiple fields are never read --> Main.rs:5:5 | 4 | struct State { | ----- fields in this struct 5 | h: [[bool; 14]; 13], | ^ 6 | v: [[bool; 13]; 14], | ^ 7 | dp: [[usize; 14 * 14]; 14 * 14], | ^^ 8 | sum_s: u32, | ^^^^^ 9 | paths: HashMap<(usize, usize, usize, usize), usize>, | ^^^^^ 10 | highway_count: u32, | ^^^^^^^^^^^^^ 11 | collaborator_count: u32, | ^^^^^^^^^^^^^^^^^^ 12 | money: u64, | ^^^^^ | = note: `#[warn(dead_code)]` on by default warning: 3 warnings emitted
ソースコード
use std::collections::HashMap; use std::io::{stdout, Write}; struct State { h: [[bool; 14]; 13], v: [[bool; 13]; 14], dp: [[usize; 14 * 14]; 14 * 14], sum_s: u32, paths: HashMap<(usize, usize, usize, usize), usize>, highway_count: u32, collaborator_count: u32, money: u64, } impl State { fn new() -> Self { let mut dp = [[0; 14 * 14]; 14 * 14]; for start_i in 0..14 { for start_j in 0..14 { for goal_i in 0..14 { for goal_j in 0..14 { let mut value = 0; if start_i > goal_i { value += start_i - goal_i; } else { value += goal_i - start_i; } if start_j > goal_j { value += start_j - goal_j; } else { value += goal_j - start_j; } dp[start_i * 14 + start_j][goal_i * 14 + goal_j] = 1000 * value; } } } } let mut paths = HashMap::new(); for _ in 0..3000 { let abcd: Vec<usize> = read_vec(); let (a, b, c, d) = (abcd[0] - 1, abcd[1] - 1, abcd[2] - 1, abcd[3] - 1); paths.insert((a, b, c, d), dp[a * 14 + b][c * 14 + d]); } Self { h: [[false; 14]; 13], v: [[false; 13]; 14], dp, sum_s: 0, paths, highway_count: 0, collaborator_count: 1, money: 1_000_000, } } fn solve(&mut self, t: usize) { let uv: Vec<u32> = read_vec(); println!("2"); stdout().flush().unwrap(); } } fn main() { let mut state = State::new(); for t in 0..400 { state.solve(t); } } fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }