結果
| 問題 | No.3436 [Cherry 8th Tune B] この夏に何が起こるかな? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-23 20:52:41 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,110 bytes |
| 記録 | |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 146,612 KB |
| 最終ジャッジ日時 | 2026-03-23 20:53:32 |
| 合計ジャッジ時間 | 47,645 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 41 WA * 2 |
ソースコード
for _ in range(int(input())):
n,m,k,p=map(int,input().split())
t=list(map(int,input().split()))
x=[[0] for i in range(k+1)]
c=list(map(int,input().split()))
y=[{} for i in range(k+1)]
for i in range(n):
x[c[i]].append(t[i])
y[0][t[i]]=i+1
y[c[i]][t[i]]=i+1
t.sort();t=[0]+t
for i in range(k+1):
x[i].sort()
a=list(map(int,input().split()))
b=list(map(int,input().split()))
z=[0]+list(map(int,input().split()))
q,w=0,1<<32
while w-q>1:
c=(q+w)//2
ans=0
e,r=0,len(t)
for i in range(m):
k=b[i];l=c-a[i]
e,r=0,len(t)
while r-e>1:
s=(e+r)//2
if t[s]<=l:
e=s
else:
r=s
ans+=e
e,r=0,len(x[k])
while r-e>1:
s=(e+r)//2
if x[k][s]-z[k]<=l:
e=s
else:
r=s
ans+=e;
e,r=0,len(x[k])
while r-e>1:
s=(e+r)//2
if x[k][s]<=l:
e=s
else:
r=s
ans-=e
if p>ans:
q=c
else:
w=c
q=w
X,Y=0,0
for i in range(m):
if q+z[b[i]]-a[i] in y[b[i]]:
X,Y=y[b[i]][q+z[b[i]]-a[i]],i+1
break
if X:
print(X,Y)
continue
for i in range(m):
if q-a[i] in y[0]:
X,Y=y[0][q-a[i]],i+1;break
print(X,Y)