結果
問題 |
No.3166 [Cherry 7th Tune *] 桜の守人
|
ユーザー |
![]() |
提出日時 | 2025-06-12 15:06:17 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 918 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,720 KB |
実行使用メモリ | 81,268 KB |
最終ジャッジ日時 | 2025-06-12 15:07:25 |
合計ジャッジ時間 | 10,151 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 TLE * 1 -- * 22 |
ソースコード
import heapq from heapq import heappop,heappush,heapify from sys import stdin, setrecursionlimit input = stdin.readline readline = stdin.readline from collections import deque,defaultdict from collections import deque d=deque() T=int(input()) for i in range(T): N,L,K=map(int, input().split()) A=list(map(int, input().split())) A=sorted(A) ng,ok=0,L+1 while ok-ng>1: mid=(ok+ng)//2 C=[0,L] D=defaultdict(int) for a in A: if a-mid>=0: D[a-mid]+=1 C.append(a-mid) else: D[0]+=1 D[a-mid+L]+=1 C.append(a-mid+L) if a+mid<L: r=a+mid D[r]-=1 C.append(r) else: D[0]+=1 D[a+mid-L]-=1 C.append(a+mid-L) C=sorted(list(set(C))) c=0 he=10**10 for i in range(len(C)-1): c+=D[C[i]] he=min(he,c) if he>=K: ok=mid else: ng=mid print(ok)