結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | convexineq |
提出日時 | 2021-01-23 18:03:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,005 ms / 2,000 ms |
コード長 | 1,262 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 118,584 KB |
最終ジャッジ日時 | 2024-06-10 01:40:41 |
合計ジャッジ時間 | 29,846 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
52,480 KB |
testcase_01 | AC | 35 ms
53,376 KB |
testcase_02 | AC | 44 ms
60,544 KB |
testcase_03 | AC | 47 ms
61,824 KB |
testcase_04 | AC | 37 ms
53,120 KB |
testcase_05 | AC | 35 ms
52,864 KB |
testcase_06 | AC | 37 ms
53,248 KB |
testcase_07 | AC | 38 ms
52,992 KB |
testcase_08 | AC | 70 ms
70,912 KB |
testcase_09 | AC | 63 ms
66,944 KB |
testcase_10 | AC | 79 ms
73,344 KB |
testcase_11 | AC | 79 ms
73,856 KB |
testcase_12 | AC | 71 ms
71,040 KB |
testcase_13 | AC | 89 ms
76,160 KB |
testcase_14 | AC | 69 ms
69,376 KB |
testcase_15 | AC | 101 ms
76,460 KB |
testcase_16 | AC | 70 ms
69,888 KB |
testcase_17 | AC | 82 ms
74,112 KB |
testcase_18 | AC | 149 ms
77,532 KB |
testcase_19 | AC | 119 ms
76,736 KB |
testcase_20 | AC | 150 ms
77,236 KB |
testcase_21 | AC | 120 ms
77,320 KB |
testcase_22 | AC | 135 ms
76,924 KB |
testcase_23 | AC | 143 ms
77,284 KB |
testcase_24 | AC | 133 ms
77,716 KB |
testcase_25 | AC | 133 ms
77,164 KB |
testcase_26 | AC | 154 ms
77,736 KB |
testcase_27 | AC | 145 ms
77,260 KB |
testcase_28 | AC | 462 ms
101,016 KB |
testcase_29 | AC | 412 ms
95,720 KB |
testcase_30 | AC | 388 ms
92,288 KB |
testcase_31 | AC | 455 ms
101,740 KB |
testcase_32 | AC | 447 ms
107,904 KB |
testcase_33 | AC | 409 ms
91,748 KB |
testcase_34 | AC | 501 ms
108,288 KB |
testcase_35 | AC | 577 ms
103,936 KB |
testcase_36 | AC | 780 ms
117,632 KB |
testcase_37 | AC | 267 ms
89,600 KB |
testcase_38 | AC | 475 ms
98,764 KB |
testcase_39 | AC | 328 ms
89,088 KB |
testcase_40 | AC | 388 ms
94,800 KB |
testcase_41 | AC | 498 ms
102,912 KB |
testcase_42 | AC | 753 ms
116,764 KB |
testcase_43 | AC | 489 ms
100,964 KB |
testcase_44 | AC | 592 ms
105,728 KB |
testcase_45 | AC | 514 ms
100,992 KB |
testcase_46 | AC | 538 ms
112,512 KB |
testcase_47 | AC | 332 ms
91,136 KB |
testcase_48 | AC | 670 ms
117,888 KB |
testcase_49 | AC | 548 ms
117,632 KB |
testcase_50 | AC | 675 ms
118,216 KB |
testcase_51 | AC | 606 ms
117,632 KB |
testcase_52 | AC | 636 ms
118,016 KB |
testcase_53 | AC | 969 ms
117,248 KB |
testcase_54 | AC | 956 ms
117,044 KB |
testcase_55 | AC | 1,005 ms
117,376 KB |
testcase_56 | AC | 963 ms
117,504 KB |
testcase_57 | AC | 743 ms
117,376 KB |
testcase_58 | AC | 671 ms
115,584 KB |
testcase_59 | AC | 678 ms
116,204 KB |
testcase_60 | AC | 678 ms
115,968 KB |
testcase_61 | AC | 677 ms
115,744 KB |
testcase_62 | AC | 675 ms
116,096 KB |
testcase_63 | AC | 250 ms
118,584 KB |
testcase_64 | AC | 248 ms
118,400 KB |
testcase_65 | AC | 242 ms
118,484 KB |
testcase_66 | AC | 253 ms
118,556 KB |
testcase_67 | AC | 245 ms
118,528 KB |
testcase_68 | AC | 36 ms
53,120 KB |
testcase_69 | AC | 35 ms
52,864 KB |
testcase_70 | AC | 36 ms
52,480 KB |
testcase_71 | AC | 36 ms
52,736 KB |
testcase_72 | AC | 39 ms
53,120 KB |
testcase_73 | AC | 36 ms
53,248 KB |
ソースコード
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)