結果
問題 |
No.507 ゲーム大会(チーム決め)
|
ユーザー |
![]() |
提出日時 | 2023-09-30 00:27:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 18,112 KB |
最終ジャッジ日時 | 2024-07-22 18:25:09 |
合計ジャッジ時間 | 9,442 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 7 |
ソースコード
import sys input = sys.stdin.readline N,M=map(int,input().split()) A=[int(input()) for i in range(N)] K=A[0] B=A[1:] B.sort() OK=len(B) NG=-1 while OK>NG+1: mid=(OK+NG)//2 now=K+B[mid] C=B[:now]+B[now+1:] ind=0 member=0 for i in range(len(C)-1,-1,-1): while ind<i and C[ind]+C[i]<=now: ind+=1 if ind<i and C[ind]+C[i]>now: member+=1 ind+=1 #print(mid,now,member) if member<M: OK=mid else: NG=mid if OK==len(B): print(-1) else: print(B[OK])