結果
問題 |
No.727 仲介人moko
|
ユーザー |
![]() |
提出日時 | 2018-08-25 04:43:32 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 814 bytes |
コンパイル時間 | 15,559 ms |
コンパイル使用メモリ | 379,348 KB |
実行使用メモリ | 9,324 KB |
最終ジャッジ日時 | 2024-06-23 22:59:02 |
合計ジャッジ時間 | 18,590 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 TLE * 1 |
other | -- * 25 |
ソースコード
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 { t.insert((p - 1, b), c * p % m); } if p != b { t.insert((p, b - 1), c * (2 * n - p - b) * b % m); } } h = t; } println!("{}", h.get(&(0,0)).unwrap()); }