結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー convexineqconvexineq
提出日時 2021-01-23 17:49:56
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,109 ms / 2,000 ms
コード長 1,312 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 191,392 KB
最終ジャッジ日時 2023-08-30 02:23:29
合計ジャッジ時間 37,570 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,432 KB
testcase_01 AC 71 ms
71,364 KB
testcase_02 AC 80 ms
75,880 KB
testcase_03 AC 83 ms
76,184 KB
testcase_04 AC 74 ms
71,352 KB
testcase_05 AC 72 ms
71,480 KB
testcase_06 AC 71 ms
71,344 KB
testcase_07 AC 72 ms
71,272 KB
testcase_08 AC 94 ms
76,808 KB
testcase_09 AC 94 ms
76,024 KB
testcase_10 AC 104 ms
76,884 KB
testcase_11 AC 106 ms
76,692 KB
testcase_12 AC 96 ms
76,808 KB
testcase_13 AC 104 ms
76,960 KB
testcase_14 AC 98 ms
76,108 KB
testcase_15 AC 114 ms
77,324 KB
testcase_16 AC 97 ms
76,556 KB
testcase_17 AC 108 ms
76,668 KB
testcase_18 AC 168 ms
78,852 KB
testcase_19 AC 139 ms
77,316 KB
testcase_20 AC 168 ms
77,784 KB
testcase_21 AC 135 ms
78,268 KB
testcase_22 AC 144 ms
78,408 KB
testcase_23 AC 158 ms
79,592 KB
testcase_24 AC 159 ms
80,432 KB
testcase_25 AC 158 ms
79,528 KB
testcase_26 AC 166 ms
79,280 KB
testcase_27 AC 146 ms
77,584 KB
testcase_28 AC 507 ms
106,532 KB
testcase_29 AC 446 ms
98,500 KB
testcase_30 AC 420 ms
92,836 KB
testcase_31 AC 511 ms
101,564 KB
testcase_32 AC 531 ms
130,908 KB
testcase_33 AC 395 ms
92,872 KB
testcase_34 AC 568 ms
116,420 KB
testcase_35 AC 625 ms
104,136 KB
testcase_36 AC 857 ms
131,636 KB
testcase_37 AC 296 ms
98,536 KB
testcase_38 AC 513 ms
99,016 KB
testcase_39 AC 354 ms
89,936 KB
testcase_40 AC 418 ms
96,636 KB
testcase_41 AC 541 ms
112,376 KB
testcase_42 AC 843 ms
118,388 KB
testcase_43 AC 529 ms
104,340 KB
testcase_44 AC 647 ms
106,336 KB
testcase_45 AC 555 ms
101,384 KB
testcase_46 AC 580 ms
120,776 KB
testcase_47 AC 364 ms
98,192 KB
testcase_48 AC 826 ms
191,376 KB
testcase_49 AC 684 ms
191,392 KB
testcase_50 AC 831 ms
191,124 KB
testcase_51 AC 742 ms
191,236 KB
testcase_52 AC 787 ms
191,344 KB
testcase_53 AC 1,093 ms
143,240 KB
testcase_54 AC 1,075 ms
143,332 KB
testcase_55 AC 1,109 ms
143,208 KB
testcase_56 AC 1,074 ms
143,304 KB
testcase_57 AC 815 ms
143,224 KB
testcase_58 AC 695 ms
130,680 KB
testcase_59 AC 692 ms
130,672 KB
testcase_60 AC 703 ms
130,496 KB
testcase_61 AC 700 ms
130,640 KB
testcase_62 AC 697 ms
130,712 KB
testcase_63 AC 277 ms
127,616 KB
testcase_64 AC 286 ms
127,784 KB
testcase_65 AC 281 ms
127,652 KB
testcase_66 AC 279 ms
127,544 KB
testcase_67 AC 278 ms
127,596 KB
testcase_68 AC 72 ms
71,268 KB
testcase_69 AC 71 ms
71,480 KB
testcase_70 AC 73 ms
71,476 KB
testcase_71 AC 72 ms
71,428 KB
testcase_72 AC 71 ms
71,376 KB
testcase_73 AC 73 ms
71,212 KB
権限があれば一括ダウンロードができます

ソースコード

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

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[0],0
    else:
        x,y = 0,cd[0]
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)
0