結果

問題 No.1044 正直者大学
ユーザー H3PO4H3PO4
提出日時 2020-05-01 22:18:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 792 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 16,060 KB
最終ジャッジ日時 2023-08-26 14:44:28
合計ジャッジ時間 7,436 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,876 KB
testcase_01 AC 13 ms
7,868 KB
testcase_02 AC 18 ms
7,812 KB
testcase_03 AC 13 ms
7,828 KB
testcase_04 AC 13 ms
7,836 KB
testcase_05 AC 363 ms
15,968 KB
testcase_06 AC 792 ms
16,060 KB
testcase_07 AC 13 ms
7,988 KB
testcase_08 AC 14 ms
7,860 KB
testcase_09 AC 14 ms
7,772 KB
testcase_10 AC 14 ms
7,812 KB
testcase_11 AC 15 ms
7,840 KB
testcase_12 AC 269 ms
13,248 KB
testcase_13 AC 515 ms
13,856 KB
testcase_14 AC 335 ms
15,008 KB
testcase_15 AC 368 ms
15,148 KB
testcase_16 AC 580 ms
14,876 KB
testcase_17 AC 312 ms
13,032 KB
testcase_18 AC 371 ms
12,592 KB
testcase_19 AC 226 ms
12,176 KB
testcase_20 AC 130 ms
10,600 KB
testcase_21 AC 183 ms
11,164 KB
testcase_22 AC 207 ms
12,304 KB
testcase_23 AC 312 ms
14,948 KB
testcase_24 AC 266 ms
13,932 KB
testcase_25 AC 334 ms
15,472 KB
testcase_26 AC 353 ms
15,728 KB
testcase_27 AC 14 ms
7,800 KB
testcase_28 AC 14 ms
7,936 KB
testcase_29 AC 14 ms
7,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
modinv = lambda a, mod=10 ** 9 + 7: pow(a, mod - 2, mod)

N, M, K = map(int, input().split())

fac, inv = [1] * (max(N, M) + 1), [1] * (max(N, M) + 1)
for i in range(1, max(N, M) + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])
comb = lambda n, r: (fac[n] * inv[r] * inv[n - r]) % MOD

x = 1
ans = 0
while N + M - 2 * x >= K and x <= min(N, M):
    ans = (ans + fac[N] * fac[M] * comb(N - 1, x - 1) * comb(M - 1, x - 1) * modinv(x)) % MOD
    x += 1
print(ans)
0