結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | 👑 Kazun |
提出日時 | 2020-09-07 00:29:54 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,923 bytes |
コンパイル時間 | 421 ms |
コンパイル使用メモリ | 87,148 KB |
実行使用メモリ | 130,468 KB |
最終ジャッジ日時 | 2023-08-27 16:08:55 |
合計ジャッジ時間 | 28,094 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 63 ms
71,328 KB |
testcase_01 | AC | 65 ms
71,420 KB |
testcase_02 | AC | 75 ms
75,568 KB |
testcase_03 | AC | 73 ms
75,868 KB |
testcase_04 | AC | 65 ms
71,392 KB |
testcase_05 | AC | 62 ms
71,324 KB |
testcase_06 | AC | 65 ms
71,404 KB |
testcase_07 | AC | 64 ms
71,204 KB |
testcase_08 | AC | 113 ms
76,940 KB |
testcase_09 | AC | 84 ms
76,856 KB |
testcase_10 | AC | 99 ms
77,380 KB |
testcase_11 | AC | 95 ms
77,000 KB |
testcase_12 | AC | 95 ms
76,640 KB |
testcase_13 | AC | 108 ms
77,208 KB |
testcase_14 | AC | 88 ms
76,552 KB |
testcase_15 | AC | 108 ms
76,552 KB |
testcase_16 | AC | 93 ms
76,868 KB |
testcase_17 | AC | 109 ms
77,020 KB |
testcase_18 | AC | 362 ms
78,480 KB |
testcase_19 | AC | 239 ms
77,072 KB |
testcase_20 | AC | 481 ms
77,812 KB |
testcase_21 | AC | 163 ms
78,244 KB |
testcase_22 | AC | 237 ms
78,160 KB |
testcase_23 | AC | 291 ms
79,476 KB |
testcase_24 | AC | 252 ms
80,344 KB |
testcase_25 | AC | 288 ms
79,360 KB |
testcase_26 | AC | 335 ms
79,488 KB |
testcase_27 | AC | 279 ms
77,400 KB |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | AC | 1,926 ms
130,468 KB |
testcase_33 | AC | 1,803 ms
92,916 KB |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
testcase_72 | -- | - |
testcase_73 | -- | - |
ソースコード
def Binary_Search_Small_Count(A,x,equal=False,sort=False): """2分探索によって,x未満の要素の個数を調べる. A:リスト x:調べる要素 sort:ソートをする必要があるかどうか(Trueで必要) equal:Trueのときはx"未満"がx"以下"になる """ if sort: A.sort() if A[0]>x or ((not equal) and A[0]==x): return 0 L,R=0,len(A) while R-L>1: C=L+(R-L)//2 if A[C]<x or (equal and A[C]==x): L=C else: R=C return L+1 def Binary_Search_Big_Count(A,x,equal=False,sort=False): """2分探索によって,xを超える要素の個数を調べる. A:リスト x:調べる要素 sort:ソートをする必要があるかどうか(Trueで必要) equal:Trueのときはx"を超える"がx"以上"になる """ if sort: A.sort() if A[-1]<x or ((not equal) and A[-1]==x): return 0 L,R=-1,len(A)-1 while R-L>1: C=L+(R-L)//2 if A[C]>x or (equal and A[C]==x): R=C else: L=C return len(A)-R def General_Binary_Increase_Search(L,R,cond,Integer=True,ep=1/(1<<20)): """条件式が単調増加であるとき,一般的な二部探索を行う. L:解の下限 R:解の上限 cond:条件(1変数関数,広義単調減少 or 広義単調減少を満たす) Integer:解を整数に制限するか? ep:Integer=Falseのとき,解の許容する誤差 """ if not(cond(R)): return False if Integer: R+=1 while R-L>1: C=L+(R-L)//2 if cond(C): R=C else: L=C return R else: while (R-L)>=ep: C=L+(R-L)/2 if cond(C): R=C else: L=C return R #================================================= def g(x): S=0 for u in U: if u>0: S+=Binary_Search_Small_Count(V,x//u,True) elif u<0: S+=Binary_Search_Big_Count(V,(-x-u-1)//(-u),True) else: if x>=0: S+=len(V) return S def h(A,B,x): G=set(B) b=B[0] for a in A: if a==0: if x==0: return (0,b) elif (x%a==0) and (x//a in G): return (a,x//a) return None #================================================= K,L,M,N,P=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) C=list(map(int,input().split())) D=list(map(int,input().split())) U=[a*b for a in A for b in B] V=[c*d for c in C for d in D] V.sort() E_abs_max=max(U,key=lambda u:abs(u))*max(V,key=lambda v:abs(v)) E_abs_max=abs(E_abs_max)+1 J=General_Binary_Increase_Search(-E_abs_max,E_abs_max,lambda x:g(x)>=P,True) p,q=h(U,V,J) a,b=h(A,B,p) c,d=h(C,D,q) print(J) print(a,b,c,d)