結果

問題 No.794 チーム戦 (2)
ユーザー htkbhtkb
提出日時 2019-02-23 00:22:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,564 KB
実行使用メモリ 30,568 KB
最終ジャッジ日時 2023-08-17 11:22:55
合計ジャッジ時間 8,376 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,228 KB
testcase_01 AC 15 ms
8,180 KB
testcase_02 AC 15 ms
8,116 KB
testcase_03 AC 15 ms
8,228 KB
testcase_04 AC 15 ms
8,148 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 15 ms
8,168 KB
testcase_13 AC 15 ms
8,176 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 388 ms
30,396 KB
testcase_19 AC 383 ms
30,416 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 243 ms
13,188 KB
testcase_30 AC 241 ms
13,052 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-i)
    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