結果

問題 No.2495 Three Sets
ユーザー prin_kemkemprin_kemkem
提出日時 2023-10-06 23:40:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 340 ms / 3,000 ms
コード長 1,228 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 123,692 KB
最終ジャッジ日時 2023-10-06 23:40:31
合計ジャッジ時間 6,864 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
81,624 KB
testcase_01 AC 182 ms
81,540 KB
testcase_02 AC 210 ms
81,784 KB
testcase_03 AC 180 ms
81,492 KB
testcase_04 AC 183 ms
81,268 KB
testcase_05 AC 182 ms
81,268 KB
testcase_06 AC 185 ms
81,552 KB
testcase_07 AC 183 ms
81,380 KB
testcase_08 AC 218 ms
81,488 KB
testcase_09 AC 207 ms
82,976 KB
testcase_10 AC 256 ms
83,396 KB
testcase_11 AC 220 ms
83,400 KB
testcase_12 AC 226 ms
83,624 KB
testcase_13 AC 290 ms
94,288 KB
testcase_14 AC 300 ms
108,316 KB
testcase_15 AC 257 ms
97,416 KB
testcase_16 AC 340 ms
123,692 KB
testcase_17 AC 339 ms
123,496 KB
testcase_18 AC 190 ms
81,648 KB
testcase_19 AC 283 ms
122,796 KB
testcase_20 AC 273 ms
123,548 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(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))
print(findMax(f, 0, NA))
0