結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー convexineqconvexineq
提出日時 2021-01-23 17:43:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,525 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 191,744 KB
最終ジャッジ日時 2023-08-30 02:16:11
合計ジャッジ時間 39,225 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,004 KB
testcase_01 AC 77 ms
71,196 KB
testcase_02 AC 85 ms
75,672 KB
testcase_03 AC 87 ms
75,872 KB
testcase_04 AC 76 ms
71,288 KB
testcase_05 AC 77 ms
71,264 KB
testcase_06 AC 77 ms
71,096 KB
testcase_07 AC 77 ms
71,196 KB
testcase_08 WA -
testcase_09 AC 97 ms
75,688 KB
testcase_10 AC 110 ms
76,496 KB
testcase_11 AC 111 ms
76,664 KB
testcase_12 WA -
testcase_13 AC 113 ms
76,784 KB
testcase_14 AC 99 ms
75,928 KB
testcase_15 WA -
testcase_16 AC 102 ms
76,584 KB
testcase_17 AC 111 ms
76,780 KB
testcase_18 AC 174 ms
78,736 KB
testcase_19 AC 143 ms
77,324 KB
testcase_20 AC 173 ms
78,228 KB
testcase_21 AC 141 ms
78,640 KB
testcase_22 WA -
testcase_23 AC 170 ms
79,352 KB
testcase_24 AC 163 ms
80,276 KB
testcase_25 AC 165 ms
79,792 KB
testcase_26 AC 171 ms
79,032 KB
testcase_27 AC 151 ms
77,404 KB
testcase_28 WA -
testcase_29 AC 454 ms
98,212 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 302 ms
98,364 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 704 ms
130,292 KB
testcase_59 AC 700 ms
130,356 KB
testcase_60 AC 714 ms
130,332 KB
testcase_61 AC 712 ms
130,284 KB
testcase_62 AC 713 ms
130,460 KB
testcase_63 AC 288 ms
127,572 KB
testcase_64 AC 289 ms
127,612 KB
testcase_65 AC 288 ms
127,520 KB
testcase_66 AC 291 ms
127,432 KB
testcase_67 AC 284 ms
127,272 KB
testcase_68 AC 77 ms
71,316 KB
testcase_69 AC 77 ms
71,236 KB
testcase_70 AC 76 ms
71,196 KB
testcase_71 AC 77 ms
71,204 KB
testcase_72 AC 75 ms
71,268 KB
testcase_73 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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())

"""
from random import randrange
K,L,M,N = 3,2,4,1
a = [randrange(-10,10) for _ in range(K)]
b = [randrange(-10,10) for _ in range(L)]
c = [randrange(-10,10) for _ in range(M)]
d = [randrange(-10,10) for _ in range(N)]
"""


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 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)
0