結果

問題 No.507 ゲーム大会(チーム決め)
コンテスト
ユーザー convexineq
提出日時 2021-02-12 06:09:44
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 69 ms / 3,000 ms
コード長 453 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 150 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 151,856 KB
最終ジャッジ日時 2026-04-02 10:08:52
合計ジャッジ時間 1,873 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def check(x):
    v = k+a[x]
    c = 1
    i = 0
    for j in range(n-2,-1,-1):
        if j==x: continue
        while i < n-1 and a[i] + a[j] <= v:
            i += 1
        if i==x: i+=1
        if i >= j: break
        c += 1
        i += 1
    return c <= m
    
    
n,m,k,*a = map(int,open(0).read().split())
a.sort()
ng = -1
ok = n-1
while ok-ng > 1:
    mid = (ok+ng)//2
    if check(mid): ok = mid
    else: ng = mid
a.append(-1)
print(a[ok])
0