結果

問題 No.1380 Borderline
ユーザー lam6er
提出日時 2025-03-26 15:43:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 60,440 KB
最終ジャッジ日時 2025-03-26 15:43:27
合計ジャッジ時間 3,160 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n, k = map(int, input().split())
p = list(map(int, input().split()))
s = sorted(p)
candidates = set()

# Add boundary conditions
candidates.add(0.0)  # All students pass if B is 0

for i in range(n):
    candidates.add(s[i])
    if i < n - 1 and s[i] < s[i+1]:
        mid = (s[i] + s[i+1]) / 2
        candidates.add(mid)

# Add a value larger than the maximum score
if n > 0:
    candidates.add(s[-1] + 1)
else:
    candidates.add(0.0)

max_count = 0

for b in candidates:
    j = bisect.bisect_left(s, b)
    count = n - j
    if count <= k and count > max_count:
        max_count = count

print(max_count)
0