結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー convexineqconvexineq
提出日時 2021-01-23 17:43:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,525 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 187,336 KB
最終ジャッジ日時 2024-06-10 01:22:23
合計ジャッジ時間 28,671 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,016 KB
testcase_01 AC 34 ms
53,372 KB
testcase_02 AC 43 ms
60,948 KB
testcase_03 AC 47 ms
62,412 KB
testcase_04 AC 36 ms
53,852 KB
testcase_05 AC 33 ms
54,384 KB
testcase_06 AC 36 ms
53,248 KB
testcase_07 AC 35 ms
53,760 KB
testcase_08 WA -
testcase_09 AC 56 ms
66,836 KB
testcase_10 AC 64 ms
71,636 KB
testcase_11 AC 67 ms
73,084 KB
testcase_12 WA -
testcase_13 AC 63 ms
71,492 KB
testcase_14 AC 57 ms
68,920 KB
testcase_15 WA -
testcase_16 AC 56 ms
67,300 KB
testcase_17 AC 65 ms
72,704 KB
testcase_18 AC 120 ms
77,608 KB
testcase_19 AC 94 ms
76,240 KB
testcase_20 AC 128 ms
76,632 KB
testcase_21 AC 102 ms
77,252 KB
testcase_22 WA -
testcase_23 AC 120 ms
78,312 KB
testcase_24 AC 126 ms
79,008 KB
testcase_25 AC 125 ms
78,688 KB
testcase_26 AC 133 ms
78,752 KB
testcase_27 AC 113 ms
76,584 KB
testcase_28 WA -
testcase_29 AC 383 ms
97,344 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 242 ms
96,732 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 587 ms
129,636 KB
testcase_59 AC 591 ms
129,580 KB
testcase_60 AC 600 ms
129,696 KB
testcase_61 AC 592 ms
129,552 KB
testcase_62 AC 611 ms
129,964 KB
testcase_63 AC 223 ms
119,400 KB
testcase_64 AC 225 ms
119,592 KB
testcase_65 AC 220 ms
119,616 KB
testcase_66 AC 221 ms
121,016 KB
testcase_67 AC 224 ms
120,348 KB
testcase_68 AC 34 ms
53,624 KB
testcase_69 AC 33 ms
53,492 KB
testcase_70 AC 35 ms
53,224 KB
testcase_71 AC 34 ms
54,664 KB
testcase_72 AC 32 ms
53,480 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