結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー vwxyzvwxyz
提出日時 2023-12-01 01:21:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,657 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 154,776 KB
最終ジャッジ日時 2023-12-01 01:22:15
合計ジャッジ時間 32,530 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
88,672 KB
testcase_01 AC 143 ms
88,672 KB
testcase_02 AC 139 ms
88,928 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 138 ms
88,672 KB
testcase_07 WA -
testcase_08 AC 153 ms
89,312 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 154 ms
89,440 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 153 ms
89,056 KB
testcase_15 AC 171 ms
89,568 KB
testcase_16 AC 155 ms
89,312 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 176 ms
90,080 KB
testcase_20 AC 205 ms
92,384 KB
testcase_21 AC 184 ms
90,464 KB
testcase_22 AC 191 ms
90,336 KB
testcase_23 WA -
testcase_24 AC 205 ms
90,464 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 184 ms
90,592 KB
testcase_28 AC 518 ms
112,816 KB
testcase_29 AC 456 ms
110,096 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 614 ms
118,880 KB
testcase_35 AC 554 ms
124,308 KB
testcase_36 AC 833 ms
133,716 KB
testcase_37 AC 376 ms
100,064 KB
testcase_38 AC 446 ms
118,484 KB
testcase_39 WA -
testcase_40 AC 428 ms
109,972 KB
testcase_41 AC 576 ms
112,608 KB
testcase_42 WA -
testcase_43 AC 536 ms
112,740 KB
testcase_44 WA -
testcase_45 AC 486 ms
118,468 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 617 ms
154,604 KB
testcase_49 AC 671 ms
154,612 KB
testcase_50 AC 682 ms
154,600 KB
testcase_51 AC 603 ms
154,668 KB
testcase_52 AC 526 ms
154,604 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 997 ms
143,968 KB
testcase_56 WA -
testcase_57 AC 834 ms
154,668 KB
testcase_58 AC 650 ms
140,256 KB
testcase_59 AC 629 ms
140,256 KB
testcase_60 AC 664 ms
140,256 KB
testcase_61 AC 637 ms
140,256 KB
testcase_62 AC 659 ms
140,256 KB
testcase_63 AC 163 ms
114,272 KB
testcase_64 AC 165 ms
114,272 KB
testcase_65 AC 160 ms
114,272 KB
testcase_66 AC 161 ms
114,272 KB
testcase_67 AC 176 ms
114,272 KB
testcase_68 AC 140 ms
88,672 KB
testcase_69 AC 139 ms
88,672 KB
testcase_70 AC 141 ms
88,672 KB
testcase_71 AC 141 ms
88,672 KB
testcase_72 AC 139 ms
88,672 KB
testcase_73 AC 149 ms
88,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()))
lst0=[]
for a in A:
    for b in B:
        lst0.append(a*b)
minus1,plus1,zero1=[],[],0
for c in C:
    for d in D:
        if c*d<0:
            minus1.append(c*d)
        elif c*d==0:
            zero1+=1
        else:
            plus1.append(c*d)
minus1.sort(reverse=True)
plus1.sort(reverse=True)
lst0.sort()
def is_ok(ans):
    cnt=0
    i=0
    for cd in minus1:
        while i<len(lst0) and lst0[i]*cd>=ans:
            i+=1
        cnt+=len(lst0)-i
    if 0<ans:
        cnt+=len(lst0)*zero1
    i=0
    for cd in plus1:
        while i<len(lst0) and lst0[i]*cd<ans:
            i+=1
        cnt+=i
    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])
0