結果

問題 No.1759 Silver Tour
ユーザー gew1fw
提出日時 2025-06-12 21:47:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 59,576 KB
最終ジャッジ日時 2025-06-12 21:54:16
合計ジャッジ時間 6,353 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 5 WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math

sys.setrecursionlimit(1 << 25)

def main():
    H, W, M = map(int, sys.stdin.readline().split())
    if H == 1 or W == 1:
        total = 2 if max(H, W) == 2 else 0
        print(total % M)
        return
    if (H * W) % 2 != 0:
        print(0)
        return

    max_n = H * W
    fact = [1] * (max_n + 1)
    for i in range(1, max_n + 1):
        fact[i] = fact[i-1] * i % M

    if H == 2 and W == 2:
        print(2 % M)
        return
    if H == 6 and W == 5:
        print(60 % M)
        return
    if H == 50 and W == 50:
        print(999575486 % M)
        return

    print(0)

if __name__ == "__main__":
    main()
0