結果

問題 No.794 チーム戦 (2)
ユーザー htkbhtkb
提出日時 2019-02-23 00:25:13
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 10,560 KB
実行使用メモリ 30,500 KB
最終ジャッジ日時 2023-08-17 11:29:59
合計ジャッジ時間 8,215 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
8,148 KB
testcase_02 AC 17 ms
8,108 KB
testcase_03 WA -
testcase_04 AC 16 ms
8,180 KB
testcase_05 AC 15 ms
8,108 KB
testcase_06 AC 15 ms
8,184 KB
testcase_07 AC 15 ms
8,176 KB
testcase_08 AC 15 ms
8,300 KB
testcase_09 AC 15 ms
8,144 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 15 ms
8,188 KB
testcase_13 AC 15 ms
8,108 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 355 ms
30,496 KB
testcase_17 AC 359 ms
30,432 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 377 ms
30,500 KB
testcase_21 AC 375 ms
30,416 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 135 ms
15,868 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 269 ms
18,192 KB
testcase_30 AC 267 ms
16,756 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
from itertools import accumulate
N, K = map(int, input().split())
a = sorted(map(int, input().split()))
b = [0]*(N+1)
ans = 1
mod = 10**9+7

for i, n in enumerate(a):
    j = bisect_left(a, K-n)
    if j > i+1:
        b[i+1] += 1
        b[j] -= 1

b = list(accumulate(b))

for i, c in enumerate(b[-2:N//2-1:-1]):
    ans = ans * max(0, (c-i)) % mod

print(ans)
0