結果

問題 No.794 チーム戦 (2)
ユーザー titiatitia
提出日時 2019-02-22 22:35:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 302 ms / 1,500 ms
コード長 600 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 30,156 KB
最終ジャッジ日時 2023-08-16 20:03:02
合計ジャッジ時間 5,766 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,168 KB
testcase_01 AC 15 ms
8,224 KB
testcase_02 AC 15 ms
8,256 KB
testcase_03 AC 14 ms
8,236 KB
testcase_04 AC 14 ms
8,200 KB
testcase_05 AC 15 ms
8,240 KB
testcase_06 AC 15 ms
8,196 KB
testcase_07 AC 14 ms
8,176 KB
testcase_08 AC 14 ms
8,172 KB
testcase_09 AC 14 ms
8,288 KB
testcase_10 AC 15 ms
8,128 KB
testcase_11 AC 14 ms
8,064 KB
testcase_12 AC 14 ms
8,224 KB
testcase_13 AC 14 ms
8,036 KB
testcase_14 AC 296 ms
30,092 KB
testcase_15 AC 302 ms
30,096 KB
testcase_16 AC 291 ms
30,068 KB
testcase_17 AC 287 ms
30,144 KB
testcase_18 AC 145 ms
29,952 KB
testcase_19 AC 144 ms
30,140 KB
testcase_20 AC 145 ms
30,156 KB
testcase_21 AC 143 ms
30,024 KB
testcase_22 AC 145 ms
21,336 KB
testcase_23 AC 153 ms
19,868 KB
testcase_24 AC 77 ms
17,384 KB
testcase_25 AC 63 ms
15,980 KB
testcase_26 AC 102 ms
16,868 KB
testcase_27 AC 190 ms
11,460 KB
testcase_28 AC 172 ms
11,336 KB
testcase_29 AC 185 ms
11,248 KB
testcase_30 AC 93 ms
11,292 KB
testcase_31 AC 84 ms
11,304 KB
testcase_32 AC 83 ms
11,404 KB
testcase_33 AC 119 ms
11,284 KB
testcase_34 AC 120 ms
11,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=10**9+7

A.sort(reverse=True)

LIST=[-1]*N

for j in range(N):
    if A[0]+A[j]<=K:
        break
else:
    print(0)
    sys.exit()

if j>1:
    LIST[0]=j

    i=1
    while j>i+1:
        if A[i]+A[j-1]<=K:
            j-=1
        else:
            LIST[i]=j
            i+=1

ANS=1
for i in range(N//2):
    if LIST[i]!=-1:
        ANS=ANS*max(0,(N-LIST[i]-i))%mod
    else:
        rest=N-2*i
        for j in range(1,rest,2):
            ANS=ANS*j%mod

        print(ANS)
        sys.exit()
0