結果

問題 No.3166 [Cherry 7th Tune *] 桜の守人
ユーザー 👑 p-adic
提出日時 2024-04-16 01:42:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,624 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2025-05-30 21:07:04
合計ジャッジ時間 3,144 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
J=lambda:map(int,I().split())
for t in R(int(I())):
	N,L,K=J()
	A=sorted(list(J()))
	A=[i//N*L+A[i%N]for i in R(N*3)]
	p,P=-1,L
	while p+1<P:
		m,l,r,b=(p+P)>>1,-P,0,1
		for i in R(N+1):
			x,y=A[i+K-1]-m,A[i]+m+1
			if x<y:
				if l+P:b&=x<r
				else:l=x
				r=y
		if (l+L<r)*b:P=m
		else:p=m
	print(P)
0