結果
| 問題 |
No.2384 Permutations of Permutations
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:28:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 491 bytes |
| コンパイル時間 | 372 ms |
| コンパイル使用メモリ | 82,768 KB |
| 実行使用メモリ | 60,244 KB |
| 最終ジャッジ日時 | 2025-06-12 14:28:47 |
| 合計ジャッジ時間 | 1,991 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 5 |
ソースコード
MOD = 998244353
def main():
import sys
input = sys.stdin.read().split()
N = int(input[0])
K = int(input[1])
m = N - K
# Precompute factorial up to m, but since m can be up to 1e5, precompute up front
max_fact = 10**5
fact = [1] * (max_fact + 1)
for i in range(1, max_fact + 1):
fact[i] = fact[i-1] * i % MOD
if m < 0:
print(0)
else:
res = (K % MOD) * fact[m] % MOD
print(res)
if __name__ == "__main__":
main()
gew1fw