結果
| 問題 |
No.507 ゲーム大会(チーム決め)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-12 04:28:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 779 bytes |
| コンパイル時間 | 240 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 125,368 KB |
| 最終ジャッジ日時 | 2024-06-25 22:20:53 |
| 合計ジャッジ時間 | 3,358 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 11 |
ソースコード
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline
N,M = map(int,input().split())
A = [int(input()) for _ in range(N)]
def is_ok(i):
threshold = A[i]+A[0]
X = []
for j in range(1,N):
if j!=i:
X.append(A[j])
X.sort(reverse=True)
v = deque(X)
cnt = 0
while v:
x = v.popleft()
while v:
y = v.pop()
if x+y>threshold:
cnt += 1
break
return cnt<M
if is_ok(1):
print(A[1])
exit()
if not is_ok(N-1):
print(-1)
exit()
y = N-1
x = 1
while y-x>1:
mid = (y+x)//2
if is_ok(mid):
y = mid
else:
x = mid
print(A[y])