結果
問題 |
No.523 LED
|
ユーザー |
![]() |
提出日時 | 2020-04-24 19:49:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 764 bytes |
コンパイル時間 | 419 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 1,024,900 KB |
最終ジャッジ日時 | 2024-09-25 22:08:56 |
合計ジャッジ時間 | 46,407 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 MLE * 24 |
ソースコード
#!/usr/bin/env python3 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(read()) MOD = 10**9 + 7 def cumprod(A, MOD=MOD): L = len(A) Lsq = int(L**.5 + 1) A = np.resize(A, Lsq**2).reshape(Lsq, Lsq) for n in range(1, Lsq): A[:, n] *= A[:, n - 1] A[:, n] %= MOD for n in range(1, Lsq): A[n] *= A[n - 1, -1] A[n] %= MOD return A.ravel()[:L] def make_fact(U, MOD=MOD): x = np.arange(U, dtype=np.int64) x[0] = 1 fact = cumprod(x, MOD) fact.flags.writeable = False return fact fact = make_fact(2 * 10**7 + 10) den = pow((1 + MOD) // 2, N, MOD) answer = fact[2 * N] * den % MOD print(answer)