結果
| 問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-01-23 17:44:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,312 bytes |
| コンパイル時間 | 278 ms |
| コンパイル使用メモリ | 82,424 KB |
| 実行使用メモリ | 187,984 KB |
| 最終ジャッジ日時 | 2024-12-31 07:50:42 |
| 合計ジャッジ時間 | 30,421 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 73 RE * 1 |
ソースコード
K,L,M,N,s = map(int,input().split())
*a, = map(int,input().split())
*b, = map(int,input().split())
*c, = map(int,input().split())
*d, = map(int,input().split())
ab = [i*j for i in a for j in b]
cd = [i*j for i in c for j in d]
ab.sort()
cd.sort()
from bisect import bisect_left
Lab = bisect_left(ab,0)
Lcd = bisect_left(cd,0)
ok = INF = 10**18
ng = -INF
KL,MN = K*L, M*N
while ok-ng > 1:
mid = (ok+ng)//2
v = r = 0
for i in range(Lab)[::-1]:
while r < Lcd and ab[i]*cd[r] > mid:
r += 1
v += Lcd-r
r = Lcd
for i in range(Lab):
while r < MN and ab[i]*cd[r] > mid:
r += 1
v += MN-r
r = 0
for i in range(Lab,KL):
while r < Lcd and ab[i]*cd[r] <= mid:
r += 1
v += r
r = Lcd
for i in range(Lab,KL)[::-1]:
while r < MN and ab[i]*cd[r] <= mid:
r += 1
v += r-Lcd
if v >= s: ok = mid
else: ng = mid
print(ok)
scd = set(cd)
if ok==0:
if 0 in cd:
x,y = ab[1],0
else:
x,y = 0,cd[1]
else:
for x in ab:
if x and ok%x==0 and ok//x in scd:
y = ok//x
break
r = [0]*4
for i in a:
for j in b:
if i*j==x: r[0],r[1] = i,j
for i in c:
for j in d:
if i*j==y: r[2],r[3] = i,j
print(*r)
convexineq