結果

問題 No.794 チーム戦 (2)
ユーザー 双六双六
提出日時 2020-07-21 22:58:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 246 ms / 1,500 ms
コード長 967 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 115,900 KB
最終ジャッジ日時 2023-08-30 04:23:47
合計ジャッジ時間 7,936 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,724 KB
testcase_01 AC 94 ms
71,868 KB
testcase_02 AC 93 ms
71,792 KB
testcase_03 AC 93 ms
71,800 KB
testcase_04 AC 94 ms
71,840 KB
testcase_05 AC 95 ms
71,592 KB
testcase_06 AC 92 ms
71,788 KB
testcase_07 AC 94 ms
71,792 KB
testcase_08 AC 95 ms
71,676 KB
testcase_09 AC 94 ms
71,632 KB
testcase_10 AC 94 ms
71,836 KB
testcase_11 AC 93 ms
71,584 KB
testcase_12 AC 94 ms
71,884 KB
testcase_13 AC 94 ms
71,756 KB
testcase_14 AC 206 ms
113,400 KB
testcase_15 AC 204 ms
112,988 KB
testcase_16 AC 204 ms
113,200 KB
testcase_17 AC 177 ms
111,468 KB
testcase_18 AC 244 ms
111,576 KB
testcase_19 AC 245 ms
111,648 KB
testcase_20 AC 244 ms
111,476 KB
testcase_21 AC 246 ms
112,000 KB
testcase_22 AC 185 ms
98,644 KB
testcase_23 AC 171 ms
96,248 KB
testcase_24 AC 169 ms
91,808 KB
testcase_25 AC 160 ms
88,716 KB
testcase_26 AC 157 ms
90,196 KB
testcase_27 AC 198 ms
115,884 KB
testcase_28 AC 206 ms
115,900 KB
testcase_29 AC 169 ms
115,760 KB
testcase_30 AC 145 ms
108,676 KB
testcase_31 AC 222 ms
109,748 KB
testcase_32 AC 221 ms
109,400 KB
testcase_33 AC 217 ms
115,572 KB
testcase_34 AC 215 ms
115,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
import bisect

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

#処理内容
def main():
	N, K = getlist()
	n = int(N // 2)
	A = list(sorted(getlist()))
	ans = 1
	stop = None
	for i in range(n):
		ind = N - 1 - i
		ind2 = bisect.bisect_left(A, K - A[ind] + 1) - 1
		if ind2 < ind:
			if ind2 + 1 - i > 0:
				ans = (ans * (ind2 + 1 - i)) % con
			else:
				ans = 0
				stop = INF
				break
		else:
			stop = n - i
			break

	if stop == INF:
		print(0)
		return
	elif stop == None:
		print(ans)
		return

	for i in range(1, 2 * stop + 1):
		ans *= i
		ans %= con

	inv_2 = inverse(2, con)
	for i in range(stop):
		ans *= inv_2
		ans %= con

	for i in range(1, stop + 1):
		ans *= inverse(i, con)
		ans %= con

	print(ans)


if __name__ == '__main__':
	main()
0