結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | vwxyz |
提出日時 | 2023-12-01 00:25:56 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,131 bytes |
コンパイル時間 | 419 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 137,728 KB |
最終ジャッジ日時 | 2024-09-26 14:59:19 |
合計ジャッジ時間 | 28,465 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 152 ms
94,976 KB |
testcase_01 | AC | 154 ms
89,344 KB |
testcase_02 | AC | 158 ms
89,728 KB |
testcase_03 | AC | 164 ms
89,856 KB |
testcase_04 | AC | 151 ms
89,600 KB |
testcase_05 | AC | 151 ms
89,472 KB |
testcase_06 | AC | 153 ms
89,600 KB |
testcase_07 | AC | 155 ms
89,600 KB |
testcase_08 | AC | 181 ms
90,624 KB |
testcase_09 | AC | 169 ms
89,856 KB |
testcase_10 | AC | 191 ms
90,880 KB |
testcase_11 | AC | 178 ms
90,624 KB |
testcase_12 | AC | 180 ms
90,624 KB |
testcase_13 | AC | 195 ms
90,752 KB |
testcase_14 | AC | 174 ms
90,624 KB |
testcase_15 | AC | 214 ms
91,008 KB |
testcase_16 | AC | 183 ms
90,624 KB |
testcase_17 | AC | 190 ms
90,880 KB |
testcase_18 | AC | 416 ms
93,440 KB |
testcase_19 | AC | 286 ms
91,008 KB |
testcase_20 | AC | 464 ms
93,696 KB |
testcase_21 | AC | 236 ms
91,136 KB |
testcase_22 | AC | 284 ms
91,136 KB |
testcase_23 | AC | 351 ms
92,032 KB |
testcase_24 | AC | 317 ms
91,520 KB |
testcase_25 | AC | 336 ms
91,904 KB |
testcase_26 | AC | 389 ms
92,544 KB |
testcase_27 | AC | 337 ms
91,648 KB |
testcase_28 | AC | 1,819 ms
110,760 KB |
testcase_29 | AC | 1,725 ms
111,392 KB |
testcase_30 | AC | 1,724 ms
111,756 KB |
testcase_31 | TLE | - |
testcase_32 | AC | 1,615 ms
119,296 KB |
testcase_33 | AC | 1,467 ms
109,156 KB |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | TLE | - |
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 | -- | - |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') #sys.set_int_max_str_digits(10**9) def Bisect_Int(ok,ng,is_ok): while abs(ok-ng)>1: mid=(ok+ng)//2 if is_ok(mid): ok=mid else: ng=mid return ok K,L,M,N,S=map(int,readline().split()) A=list(map(int,readline().split())) B=list(map(int,readline().split())) C=list(map(int,readline().split())) D=list(map(int,readline().split())) plus0,minus0,zero0=[],[],0 for a in A: for b in B: if a*b>0: plus0.append(a*b) elif a*b<0: minus0.append(-a*b) else: zero0+=1 plus1,minus1,zero1=[],[],0 for c in C: for d in D: if c*d>0: plus1.append(c*d) elif c*d<0: minus1.append(-c*d) else: zero1+=1 minus0.sort() minus1.sort() plus0.sort() plus1.sort() def is_ok(ans): cnt=0 if ans<0: for ab in minus0: cnt+=len(plus1)-bisect.bisect_left(plus1,(-ans)//ab+1) for ab in plus0: cnt+=len(minus1)-bisect.bisect_left(minus1,(-ans)//ab+1) elif ans==0: cnt+=len(plus0)*len(minus1) cnt+=len(plus1)*len(minus0) else: cnt+=len(plus0)*len(minus1) cnt+=len(plus1)*len(minus0) cnt+=zero0*(len(plus1)+len(minus1))+zero1*(len(plus0)+len(minus0))+zero0*zero1 for ab in minus0: cnt+=bisect.bisect_right(minus1,(ans-1)//ab) for ab in plus0: cnt+=bisect.bisect_right(plus1,(ans-1)//ab) return cnt<S inf=1<<60 ans=Bisect_Int(-inf,inf,is_ok) if ans==0: for kk in range(K): if A[kk]==0: k,l,m,n=kk,0,0,0 break else: for ll in range(L): if B[ll]==0: k,l,m,n=0,ll,0,0 break else: for mm in range(M): if C[mm]==0: k,l,m,n=0,0,mm,0 break else: for nn in range(N): if D[nn]==0: k,l,m,n=0,0,0,nn else: dct={} for k in range(K): for l in range(L): dct[A[k]*B[l]]=(k,l) for m in range(M): for n in range(N): cd=C[m]*D[n] if cd and ans%cd==0 and ans//cd in dct: k,l=dct[ans//cd] break else: continue break print(ans) print(A[k],B[l],C[m],D[n])