結果
問題 | No.727 仲介人moko |
ユーザー |
![]() |
提出日時 | 2018-08-25 04:53:09 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 989 bytes |
コンパイル時間 | 18,117 ms |
コンパイル使用メモリ | 399,464 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-06-23 23:14:57 |
合計ジャッジ時間 | 17,368 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 TLE * 1 |
other | -- * 25 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:22:21 | 22 | let mut e = t.entry((p - 1, b)).or_insert(0); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable does not need to be mutable --> src/main.rs:27:21 | 27 | let mut e = t.entry((p, b - 1)).or_insert(0); | ----^ | | | help: remove this `mut`
ソースコード
use std::io::{Read, stdin}; use std::collections::HashMap; fn main() { let mut buf = String::new(); stdin().read_to_string(&mut buf).unwrap(); let mut tok = buf.split_whitespace(); let mut get = || tok.next().unwrap(); macro_rules! get { ($t:ty) => (get().parse::<$t>().unwrap()); () => (get!(i64)); } let m = 1000000007; let n = get!(); let mut h = HashMap::new(); h.insert((n, n), 1); for _ in 0..2*n { let mut t = HashMap::new(); for (&(p, b), c) in h.iter() { if p > 0 { let mut e = t.entry((p - 1, b)).or_insert(0); let c = *e + (c * p) % m; *e = c % m; } if p != b { let mut e = t.entry((p, b - 1)).or_insert(0); let c = *e + (c * b % m); // * (2 * n - p - b) % m; *e = c % m; } } h = t; } println!("{}", h.get(&(0,0)).unwrap()); }