結果
問題 | No.523 LED |
ユーザー |
![]() |
提出日時 | 2020-02-24 19:25:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 819 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 513,280 KB |
最終ジャッジ日時 | 2024-10-12 09:22:36 |
合計ジャッジ時間 | 45,480 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 # from numba import njit # %% 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)