結果

問題 No.794 チーム戦 (2)
ユーザー htkbhtkb
提出日時 2019-02-23 00:26:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 383 ms / 1,500 ms
コード長 395 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 10,608 KB
実行使用メモリ 30,524 KB
最終ジャッジ日時 2023-08-17 11:32:43
合計ジャッジ時間 7,989 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,104 KB
testcase_01 AC 15 ms
8,300 KB
testcase_02 AC 14 ms
8,204 KB
testcase_03 AC 15 ms
8,184 KB
testcase_04 AC 15 ms
8,260 KB
testcase_05 AC 15 ms
8,340 KB
testcase_06 AC 15 ms
8,256 KB
testcase_07 AC 15 ms
8,280 KB
testcase_08 AC 15 ms
8,256 KB
testcase_09 AC 15 ms
8,112 KB
testcase_10 AC 16 ms
8,244 KB
testcase_11 AC 15 ms
8,112 KB
testcase_12 AC 15 ms
8,260 KB
testcase_13 AC 16 ms
8,172 KB
testcase_14 AC 356 ms
30,420 KB
testcase_15 AC 354 ms
30,496 KB
testcase_16 AC 369 ms
30,432 KB
testcase_17 AC 351 ms
30,444 KB
testcase_18 AC 383 ms
30,432 KB
testcase_19 AC 371 ms
30,432 KB
testcase_20 AC 366 ms
30,524 KB
testcase_21 AC 367 ms
30,516 KB
testcase_22 AC 217 ms
21,536 KB
testcase_23 AC 192 ms
20,012 KB
testcase_24 AC 161 ms
17,408 KB
testcase_25 AC 134 ms
15,896 KB
testcase_26 AC 144 ms
16,736 KB
testcase_27 AC 286 ms
19,480 KB
testcase_28 AC 288 ms
19,464 KB
testcase_29 AC 289 ms
19,472 KB
testcase_30 AC 271 ms
18,136 KB
testcase_31 AC 313 ms
19,464 KB
testcase_32 AC 309 ms
19,492 KB
testcase_33 AC 299 ms
19,400 KB
testcase_34 AC 300 ms
19,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
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_right(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