結果

問題 No.794 チーム戦 (2)
ユーザー 双六双六
提出日時 2020-07-21 22:55:16
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 924 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 112,840 KB
最終ジャッジ日時 2023-08-30 04:17:21
合計ジャッジ時間 6,545 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,536 KB
testcase_01 AC 92 ms
71,864 KB
testcase_02 AC 92 ms
71,660 KB
testcase_03 AC 93 ms
71,360 KB
testcase_04 AC 94 ms
71,708 KB
testcase_05 RE -
testcase_06 AC 94 ms
71,768 KB
testcase_07 AC 93 ms
71,404 KB
testcase_08 RE -
testcase_09 AC 92 ms
71,364 KB
testcase_10 AC 91 ms
71,500 KB
testcase_11 AC 93 ms
71,692 KB
testcase_12 AC 91 ms
71,504 KB
testcase_13 AC 95 ms
71,644 KB
testcase_14 AC 206 ms
112,660 KB
testcase_15 AC 201 ms
112,316 KB
testcase_16 AC 199 ms
112,840 KB
testcase_17 AC 175 ms
111,608 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

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

	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