結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | convexineq |
提出日時 | 2021-01-23 17:49:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,105 ms / 2,000 ms |
コード長 | 1,312 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 82,832 KB |
実行使用メモリ | 188,000 KB |
最終ジャッジ日時 | 2024-06-10 01:28:45 |
合計ジャッジ時間 | 32,142 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
52,496 KB |
testcase_01 | AC | 39 ms
53,344 KB |
testcase_02 | AC | 48 ms
60,908 KB |
testcase_03 | AC | 49 ms
61,904 KB |
testcase_04 | AC | 40 ms
52,940 KB |
testcase_05 | AC | 38 ms
53,704 KB |
testcase_06 | AC | 39 ms
53,496 KB |
testcase_07 | AC | 39 ms
53,156 KB |
testcase_08 | AC | 64 ms
68,540 KB |
testcase_09 | AC | 59 ms
68,120 KB |
testcase_10 | AC | 72 ms
72,536 KB |
testcase_11 | AC | 73 ms
72,308 KB |
testcase_12 | AC | 64 ms
67,736 KB |
testcase_13 | AC | 75 ms
72,492 KB |
testcase_14 | AC | 64 ms
69,072 KB |
testcase_15 | AC | 82 ms
74,464 KB |
testcase_16 | AC | 65 ms
68,768 KB |
testcase_17 | AC | 73 ms
71,912 KB |
testcase_18 | AC | 138 ms
77,344 KB |
testcase_19 | AC | 110 ms
75,896 KB |
testcase_20 | AC | 139 ms
76,872 KB |
testcase_21 | AC | 107 ms
77,372 KB |
testcase_22 | AC | 116 ms
77,364 KB |
testcase_23 | AC | 128 ms
78,304 KB |
testcase_24 | AC | 132 ms
78,984 KB |
testcase_25 | AC | 126 ms
78,756 KB |
testcase_26 | AC | 134 ms
78,508 KB |
testcase_27 | AC | 117 ms
76,440 KB |
testcase_28 | AC | 488 ms
105,908 KB |
testcase_29 | AC | 426 ms
97,208 KB |
testcase_30 | AC | 400 ms
92,264 KB |
testcase_31 | AC | 488 ms
100,648 KB |
testcase_32 | AC | 508 ms
129,076 KB |
testcase_33 | AC | 373 ms
91,392 KB |
testcase_34 | AC | 545 ms
115,856 KB |
testcase_35 | AC | 604 ms
103,088 KB |
testcase_36 | AC | 843 ms
130,156 KB |
testcase_37 | AC | 270 ms
96,844 KB |
testcase_38 | AC | 492 ms
97,936 KB |
testcase_39 | AC | 329 ms
89,296 KB |
testcase_40 | AC | 395 ms
95,184 KB |
testcase_41 | AC | 522 ms
110,508 KB |
testcase_42 | AC | 826 ms
117,028 KB |
testcase_43 | AC | 512 ms
102,644 KB |
testcase_44 | AC | 625 ms
105,516 KB |
testcase_45 | AC | 535 ms
100,444 KB |
testcase_46 | AC | 559 ms
119,732 KB |
testcase_47 | AC | 340 ms
96,756 KB |
testcase_48 | AC | 797 ms
187,160 KB |
testcase_49 | AC | 663 ms
188,000 KB |
testcase_50 | AC | 813 ms
187,816 KB |
testcase_51 | AC | 729 ms
187,036 KB |
testcase_52 | AC | 771 ms
187,548 KB |
testcase_53 | AC | 1,073 ms
140,912 KB |
testcase_54 | AC | 1,065 ms
140,788 KB |
testcase_55 | AC | 1,105 ms
141,424 KB |
testcase_56 | AC | 1,070 ms
141,344 KB |
testcase_57 | AC | 802 ms
141,064 KB |
testcase_58 | AC | 680 ms
129,616 KB |
testcase_59 | AC | 679 ms
129,812 KB |
testcase_60 | AC | 692 ms
129,264 KB |
testcase_61 | AC | 719 ms
129,552 KB |
testcase_62 | AC | 691 ms
129,316 KB |
testcase_63 | AC | 253 ms
119,384 KB |
testcase_64 | AC | 252 ms
118,820 KB |
testcase_65 | AC | 254 ms
119,872 KB |
testcase_66 | AC | 253 ms
119,880 KB |
testcase_67 | AC | 250 ms
119,784 KB |
testcase_68 | AC | 40 ms
54,324 KB |
testcase_69 | AC | 38 ms
53,476 KB |
testcase_70 | AC | 39 ms
53,332 KB |
testcase_71 | AC | 39 ms
53,944 KB |
testcase_72 | AC | 40 ms
53,284 KB |
testcase_73 | AC | 39 ms
52,980 KB |
ソースコード
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)