結果
問題 | No.794 チーム戦 (2) |
ユーザー |
![]() |
提出日時 | 2019-02-22 22:35:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 366 ms / 1,500 ms |
コード長 | 600 bytes |
コンパイル時間 | 133 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 32,660 KB |
最終ジャッジ日時 | 2024-11-25 09:58:16 |
合計ジャッジ時間 | 5,584 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
import sysinput = sys.stdin.readlineN,K=map(int,input().split())A=list(map(int,input().split()))mod=10**9+7A.sort(reverse=True)LIST=[-1]*Nfor j in range(N):if A[0]+A[j]<=K:breakelse:print(0)sys.exit()if j>1:LIST[0]=ji=1while j>i+1:if A[i]+A[j-1]<=K:j-=1else:LIST[i]=ji+=1ANS=1for i in range(N//2):if LIST[i]!=-1:ANS=ANS*max(0,(N-LIST[i]-i))%modelse:rest=N-2*ifor j in range(1,rest,2):ANS=ANS*j%modprint(ANS)sys.exit()