結果
問題 | No.507 ゲーム大会(チーム決め) |
ユーザー |
![]() |
提出日時 | 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 sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesfrom 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] + medel B[n]B = deque(B)pair_cnt = 0while len(B) >= 2:if B[0] + B[-1] > team_pt:pair_cnt += 1B.popleft()B.pop()else:B.popleft()return pair_cnt <= M - 1# %%left = 0right = N - 1while left + 1 < right:x = (left + right) // 2if can_win(x):right = xelse:left = x# %%print(-1 if right == N - 1 else A[right])