結果

問題 No.3166 [Cherry 7th Tune *] 桜の守人
ユーザー 👑 p-adic
提出日時 2024-04-16 01:33:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 518 ms / 2,000 ms
コード長 319 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 14,192 KB
最終ジャッジ日時 2025-05-30 21:07:10
合計ジャッジ時間 13,864 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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