結果
| 問題 |
No.3166 [Cherry 7th Tune *] 桜の守人
|
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2025-06-12 15:05:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 916 bytes |
| コンパイル時間 | 138 ms |
| コンパイル使用メモリ | 82,760 KB |
| 実行使用メモリ | 81,300 KB |
| 最終ジャッジ日時 | 2025-06-12 15:06:58 |
| 合計ジャッジ時間 | 9,898 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
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)
timi