結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー convexineqconvexineq
提出日時 2021-01-23 18:03:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,168 ms / 2,000 ms
コード長 1,262 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 111,892 KB
最終ジャッジ日時 2023-08-30 02:36:09
合計ジャッジ時間 40,381 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,112 KB
testcase_01 AC 78 ms
71,128 KB
testcase_02 AC 85 ms
75,744 KB
testcase_03 AC 87 ms
75,584 KB
testcase_04 AC 77 ms
71,236 KB
testcase_05 AC 76 ms
71,384 KB
testcase_06 AC 77 ms
71,100 KB
testcase_07 AC 78 ms
71,320 KB
testcase_08 AC 109 ms
76,792 KB
testcase_09 AC 98 ms
75,760 KB
testcase_10 AC 118 ms
77,012 KB
testcase_11 AC 118 ms
76,972 KB
testcase_12 AC 109 ms
76,528 KB
testcase_13 AC 124 ms
77,336 KB
testcase_14 AC 105 ms
76,428 KB
testcase_15 AC 144 ms
77,376 KB
testcase_16 AC 108 ms
76,688 KB
testcase_17 AC 118 ms
76,668 KB
testcase_18 AC 190 ms
78,564 KB
testcase_19 AC 160 ms
77,792 KB
testcase_20 AC 198 ms
78,096 KB
testcase_21 AC 167 ms
78,332 KB
testcase_22 AC 181 ms
78,208 KB
testcase_23 AC 189 ms
78,196 KB
testcase_24 AC 173 ms
78,124 KB
testcase_25 AC 176 ms
78,124 KB
testcase_26 AC 196 ms
78,224 KB
testcase_27 AC 185 ms
77,836 KB
testcase_28 AC 574 ms
102,096 KB
testcase_29 AC 499 ms
96,988 KB
testcase_30 AC 463 ms
93,300 KB
testcase_31 AC 548 ms
102,124 KB
testcase_32 AC 536 ms
108,008 KB
testcase_33 AC 440 ms
92,200 KB
testcase_34 AC 601 ms
105,644 KB
testcase_35 AC 687 ms
103,688 KB
testcase_36 AC 922 ms
108,096 KB
testcase_37 AC 332 ms
90,612 KB
testcase_38 AC 577 ms
98,704 KB
testcase_39 AC 399 ms
89,448 KB
testcase_40 AC 472 ms
94,872 KB
testcase_41 AC 590 ms
103,384 KB
testcase_42 AC 895 ms
110,468 KB
testcase_43 AC 585 ms
101,088 KB
testcase_44 AC 683 ms
104,820 KB
testcase_45 AC 616 ms
101,736 KB
testcase_46 AC 630 ms
107,292 KB
testcase_47 AC 400 ms
91,300 KB
testcase_48 AC 793 ms
111,448 KB
testcase_49 AC 641 ms
111,328 KB
testcase_50 AC 793 ms
111,104 KB
testcase_51 AC 705 ms
111,492 KB
testcase_52 AC 758 ms
111,288 KB
testcase_53 AC 1,143 ms
111,892 KB
testcase_54 AC 1,122 ms
111,460 KB
testcase_55 AC 1,168 ms
111,640 KB
testcase_56 AC 1,136 ms
111,492 KB
testcase_57 AC 882 ms
111,524 KB
testcase_58 AC 798 ms
110,524 KB
testcase_59 AC 808 ms
110,064 KB
testcase_60 AC 808 ms
110,012 KB
testcase_61 AC 809 ms
110,172 KB
testcase_62 AC 808 ms
110,100 KB
testcase_63 AC 305 ms
109,552 KB
testcase_64 AC 304 ms
109,636 KB
testcase_65 AC 305 ms
109,648 KB
testcase_66 AC 304 ms
109,488 KB
testcase_67 AC 306 ms
109,640 KB
testcase_68 AC 77 ms
71,148 KB
testcase_69 AC 78 ms
71,072 KB
testcase_70 AC 79 ms
71,156 KB
testcase_71 AC 73 ms
71,020 KB
testcase_72 AC 75 ms
71,016 KB
testcase_73 AC 76 ms
71,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K,L,M,N,s,*A = map(int,open(0).read().split())
a,b,c,d = A[:K],A[K:K+L],A[K+L:K+L+M],A[K+L+M:K+L+M+N]
ab = sorted(i*j for i in a for j in b)
cd = sorted(i*j for i in c for j in d)
from bisect import bisect_left
Lab = bisect_left(ab,0)
Lcd = bisect_left(cd,0)
ok = INF = 10**18
ng = -INF
MN = 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
        if r < MN and ab[i]*cd[r] == mid: x,y = ab[i],cd[r]
    r = Lcd
    for i in range(Lab):
        while r < MN and ab[i]*cd[r] > mid:
            r += 1
        v += MN-r
        if r < MN and ab[i]*cd[r] == mid: x,y = ab[i],cd[r]
    r = 0        
    for i in range(Lab,K*L):
        while r < Lcd and ab[i]*cd[r] <= mid:
            if ab[i]*cd[r] == mid: x,y = ab[i],cd[r]
            r += 1
        v += r
    r = Lcd
    for i in range(Lab,K*L)[::-1]:
        while r < MN and ab[i]*cd[r] <= mid:
            if ab[i]*cd[r] == mid: x,y = ab[i],cd[r]
            r += 1
        v += r-Lcd
    if v >= s: ok = mid
    else: ng = mid

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