結果

問題 No.2774 Wake up Record 2
ユーザー tipstar0125
提出日時 2024-06-07 22:20:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 90,368 KB
最終ジャッジ日時 2024-12-26 08:28:13
合計ジャッジ時間 2,412 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=list(map(int,input().split()))
A=list(map(int,input().split()))

ok=0
ng=int(1e9)+5

def f(n):
    cnt=0
    for a in A:
        if a<=n:cnt+=1
    return cnt<=K

while ng-ok>1:
    m=(ok+ng)//2
    if f(m):ok=m
    else:ng=m

ans=[]
for i in range(1,N):
    if A[i-1]<=ok and A[i]>ok:ans.append(i+1)
print(len(ans))
print(*ans)
0