結果

問題 No.507 ゲーム大会(チーム決め)
コンテスト
ユーザー convexineq
提出日時 2021-02-12 06:09:44
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 103 ms / 3,000 ms
+ 577µs
コード長 453 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,418 ms
コンパイル使用メモリ 95,340 KB
実行使用メモリ 103,040 KB
最終ジャッジ日時 2026-08-17 10:42:24
合計ジャッジ時間 4,741 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_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