結果
問題 | No.507 ゲーム大会(チーム決め) |
ユーザー | tktk_snsn |
提出日時 | 2021-01-25 09:40:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 773 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 87,140 KB |
実行使用メモリ | 111,628 KB |
最終ジャッジ日時 | 2023-09-03 20:08:59 |
合計ジャッジ時間 | 5,572 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 100 ms
71,708 KB |
testcase_01 | AC | 99 ms
71,612 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 100 ms
71,884 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 183 ms
111,272 KB |
testcase_10 | AC | 186 ms
111,532 KB |
testcase_11 | WA | - |
testcase_12 | AC | 183 ms
111,496 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 98 ms
71,752 KB |
testcase_20 | WA | - |
ソースコード
from collections import deque import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M = map(int, input().split()) A = int(input()) B = [int(input()) for _ in range(N - 1)] btoi = {b: i for i, b in enumerate(sorted(set(B)))} def F(x): C = deque() for i, b in enumerate(B): if i == x: continue C.append(b) score = A + B[x] cnt = 0 while C: R = C.pop() ok = False while C: L = C.popleft() if R + L > score: ok = True break cnt += ok return cnt >= M l = 0 r = N-1 while (r - l) > 1: m = (r + l) // 2 if F(m): l = m else: r = m if r == N - 1: print(-1) else: print(B[r])