結果
| 問題 |
No.794 チーム戦 (2)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-01-07 02:22:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 627 ms / 1,500 ms |
| コード長 | 767 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 55,356 KB |
| 最終ジャッジ日時 | 2024-11-23 00:32:21 |
| 合計ジャッジ時間 | 23,357 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N,K = map(int,readline().split())
A = np.array(read().split(),np.int64)
A.sort()
cand = np.searchsorted(A,(K-A),'right') # 自分のペアにできる人数
mid = np.searchsorted(A,K//2,'right')
x = (cand - np.arange(N)[::-1])[mid:]
rest = N - 2 * len(x)
x = np.concatenate([x,np.arange(1,rest,2)])
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]
answer = cumprod(x)[-1]
print(answer)
maspy