結果
| 問題 |
No.507 ゲーム大会(チーム決め)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-03 22:03:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 794 bytes |
| コンパイル時間 | 284 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 20,144 KB |
| 最終ジャッジ日時 | 2024-10-13 23:07:25 |
| 合計ジャッジ時間 | 5,597 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 WA * 2 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque
# %%
N, M, *A = map(int, read().split())
# %%
me = A[0]
A = sorted(A[1:])
# %%
def can_win(n):
# n番目の人と組んだ場合の結果
B = A[:]
team_pt = B[n] + me
del B[n]
B = deque(B)
pair_cnt = 0
while len(B) >= 2:
if B[0] + B[-1] > team_pt:
pair_cnt += 1
B.popleft()
B.pop()
else:
B.popleft()
return pair_cnt <= M - 1
# %%
left = 0
right = N - 1
while left + 1 < right:
x = (left + right) // 2
if can_win(x):
right = x
else:
left = x
# %%
print(-1 if right == N - 1 else A[right])
maspy