結果
問題 | No.507 ゲーム大会(チーム決め) |
ユーザー |
![]() |
提出日時 | 2021-02-12 06:09:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 97 ms / 3,000 ms |
コード長 | 453 bytes |
コンパイル時間 | 545 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 94,912 KB |
最終ジャッジ日時 | 2024-07-18 15:53:57 |
合計ジャッジ時間 | 2,123 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
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])