結果

問題 No.727 仲介人moko
ユーザー 特命ログイン特命ログイン
提出日時 2018-08-25 04:43:32
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 814 bytes
コンパイル時間 3,280 ms
コンパイル使用メモリ 155,532 KB
実行使用メモリ 4,568 KB
最終ジャッジ日時 2023-09-06 04:10:30
合計ジャッジ時間 6,200 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,568 KB
testcase_02 WA -
testcase_03 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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());
}
0