結果
問題 | No.523 LED |
ユーザー |
![]() |
提出日時 | 2020-07-15 18:30:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 764 bytes |
コンパイル時間 | 379 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 1,025,728 KB |
最終ジャッジ日時 | 2024-11-22 05:57:13 |
合計ジャッジ時間 | 59,034 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 24 MLE * 1 |
ソースコード
#!/usr/bin/env python3import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesimport numpy as npN = int(read())MOD = 10**9 + 7def 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] %= MODfor n in range(1, Lsq):A[n] *= A[n - 1, -1]A[n] %= MODreturn A.ravel()[:L]def make_fact(U, MOD=MOD):x = np.arange(U, dtype=np.int64)x[0] = 1fact = cumprod(x, MOD)fact.flags.writeable = Falsereturn factfact = make_fact(2 * 10**7 + 10)den = pow((1 + MOD) // 2, N, MOD)answer = fact[2 * N] * den % MODprint(answer)