結果

問題 No.2495 Three Sets
ユーザー prin_kemkemprin_kemkem
提出日時 2023-10-06 23:31:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 353 ms / 3,000 ms
コード長 1,326 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 123,640 KB
最終ジャッジ日時 2023-10-06 23:31:25
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
81,660 KB
testcase_01 AC 194 ms
81,416 KB
testcase_02 AC 178 ms
81,736 KB
testcase_03 AC 175 ms
81,184 KB
testcase_04 AC 175 ms
81,440 KB
testcase_05 AC 179 ms
81,516 KB
testcase_06 AC 179 ms
81,460 KB
testcase_07 AC 203 ms
81,456 KB
testcase_08 AC 176 ms
81,416 KB
testcase_09 AC 196 ms
83,188 KB
testcase_10 AC 203 ms
83,432 KB
testcase_11 AC 227 ms
83,516 KB
testcase_12 AC 237 ms
83,208 KB
testcase_13 AC 271 ms
94,436 KB
testcase_14 AC 287 ms
107,988 KB
testcase_15 AC 246 ms
97,560 KB
testcase_16 AC 353 ms
123,640 KB
testcase_17 AC 330 ms
123,460 KB
testcase_18 AC 178 ms
81,224 KB
testcase_19 AC 275 ms
122,888 KB
testcase_20 AC 294 ms
123,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
import copy
from itertools import combinations, permutations, product, accumulate, groupby, chain
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint
import sys
# sys.setrecursionlimit(700000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)

#################################################

def f(k):
    sa = SA[i]
    sb = SB[j]
    sc = SC[k]
    return sa*j + sb*k + sc*i

def f(i):
    def g(j):
        def h(k):
            sa = SA[i]
            sb = SB[j]
            sc = SC[k]
            return sa*j + sb*k + sc*i
        return findMax(h, 0, NC)
    return findMax(g, 0, NB)

def findMax(f, l, r):
    while r-l >= 3:
        c1 = l+(r-l)//3
        c2 = r-(r-l)//3
        if f(c1) > f(c2): r = c2
        else: l = c1
    return max(f(x) for x in range(l, r+1))

NA, NB, NC = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

SA = [0]+list(accumulate(A))
SB = [0]+list(accumulate(B))
SC = [0]+list(accumulate(C))

ans = findMax(f, 0, NA)
print(ans)
0