結果

問題 No.507 ゲーム大会(チーム決め)
ユーザー convexineqconvexineq
提出日時 2021-02-12 06:09:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 3,000 ms
コード長 453 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 96,044 KB
最終ジャッジ日時 2023-09-25 20:05:26
合計ジャッジ時間 4,459 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,408 KB
testcase_01 AC 68 ms
70,956 KB
testcase_02 AC 70 ms
71,492 KB
testcase_03 AC 71 ms
71,448 KB
testcase_04 AC 72 ms
70,976 KB
testcase_05 AC 68 ms
71,516 KB
testcase_06 AC 70 ms
71,456 KB
testcase_07 AC 131 ms
95,472 KB
testcase_08 AC 118 ms
96,044 KB
testcase_09 AC 104 ms
93,568 KB
testcase_10 AC 112 ms
93,408 KB
testcase_11 AC 117 ms
93,268 KB
testcase_12 AC 106 ms
93,892 KB
testcase_13 AC 133 ms
95,528 KB
testcase_14 AC 124 ms
94,080 KB
testcase_15 AC 130 ms
93,936 KB
testcase_16 AC 123 ms
94,484 KB
testcase_17 AC 71 ms
71,484 KB
testcase_18 AC 68 ms
71,284 KB
testcase_19 AC 70 ms
71,212 KB
testcase_20 AC 67 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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