結果
問題 | No.507 ゲーム大会(チーム決め) |
ユーザー | Navier_Boltzmann |
提出日時 | 2022-10-12 04:28:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 779 bytes |
コンパイル時間 | 834 ms |
コンパイル使用メモリ | 86,800 KB |
実行使用メモリ | 126,328 KB |
最終ジャッジ日時 | 2023-09-08 05:06:36 |
合計ジャッジ時間 | 5,187 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 109 ms
72,756 KB |
testcase_01 | AC | 108 ms
72,724 KB |
testcase_02 | WA | - |
testcase_03 | AC | 108 ms
72,744 KB |
testcase_04 | WA | - |
testcase_05 | AC | 108 ms
72,884 KB |
testcase_06 | AC | 107 ms
72,752 KB |
testcase_07 | AC | 190 ms
93,336 KB |
testcase_08 | WA | - |
testcase_09 | AC | 252 ms
123,884 KB |
testcase_10 | AC | 247 ms
126,328 KB |
testcase_11 | WA | - |
testcase_12 | AC | 252 ms
123,300 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 105 ms
73,028 KB |
testcase_20 | WA | - |
ソースコード
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])