結果

問題 No.2495 Three Sets
ユーザー mkawa2mkawa2
提出日時 2023-10-06 22:32:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,785 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 126,028 KB
最終ジャッジ日時 2023-10-06 22:32:51
合計ジャッジ時間 18,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,324 KB
testcase_01 AC 74 ms
71,504 KB
testcase_02 AC 76 ms
75,120 KB
testcase_03 AC 75 ms
71,620 KB
testcase_04 AC 74 ms
71,548 KB
testcase_05 AC 72 ms
71,448 KB
testcase_06 AC 70 ms
71,716 KB
testcase_07 AC 74 ms
71,324 KB
testcase_08 AC 70 ms
71,540 KB
testcase_09 AC 90 ms
77,472 KB
testcase_10 AC 107 ms
77,364 KB
testcase_11 AC 123 ms
77,780 KB
testcase_12 AC 129 ms
77,656 KB
testcase_13 AC 665 ms
87,276 KB
testcase_14 AC 1,651 ms
106,580 KB
testcase_15 AC 576 ms
90,240 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 70 ms
71,236 KB
testcase_19 AC 2,191 ms
124,448 KB
testcase_20 AC 2,382 ms
126,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 63)
# md = 10**9+7
md = 998244353

def cumsum(aa):
    cs = [0]
    for a in aa: cs.append(cs[-1]+a)
    return cs

def f(i, j, k):
    return sa[i]*j+sb[j]*k+sc[k]*i

na, nb, nc = LI()
aa = LI()
bb = LI()
cc = LI()
aa.sort(reverse=True)
bb.sort(reverse=True)
cc.sort(reverse=True)

sa = cumsum(aa)
sb = cumsum(bb)
sc = cumsum(cc)

def score(i,j):
    l,r=0,nc
    while 1:
        if l+1==r:
            return max(f(i,j,l),f(i,j,r))
        if l+2==r:
            m=(l+r)//2
            return max(f(i,j,l),f(i,j,m),f(i,j,r))
        m1=(l*2+r)//3
        m2=(l+r*2)//3
        if f(i,j,m1)>f(i,j,m2):
            r=m2
        else:
            l=m1

def search(i):
    l,r=0,nb
    while 1:
        if l+1==r:
            return max(score(i,l),score(i,r))
        if l+2==r:
            m=(l+r)//2
            return max(score(i,l),score(i,m),score(i,r))
        m1=(l*2+r)//3
        m2=(l+r*2)//3
        if score(i,m1)>score(i,m2):
            r=m2
        else:
            l=m1

ans=0
for i in range(na+1):
    ans=max(ans,search(i))

print(ans)
0