結果

問題 No.2495 Three Sets
ユーザー prin_kemkemprin_kemkem
提出日時 2023-10-06 23:28:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,302 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 128,168 KB
最終ジャッジ日時 2023-10-06 23:28:19
合計ジャッジ時間 13,062 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
85,848 KB
testcase_01 AC 181 ms
81,572 KB
testcase_02 AC 192 ms
81,724 KB
testcase_03 AC 181 ms
81,384 KB
testcase_04 AC 182 ms
81,440 KB
testcase_05 AC 187 ms
81,568 KB
testcase_06 AC 186 ms
81,572 KB
testcase_07 AC 211 ms
81,516 KB
testcase_08 AC 181 ms
81,340 KB
testcase_09 AC 221 ms
83,500 KB
testcase_10 AC 225 ms
83,388 KB
testcase_11 AC 278 ms
84,028 KB
testcase_12 AC 288 ms
83,400 KB
testcase_13 AC 993 ms
94,416 KB
testcase_14 AC 2,527 ms
108,432 KB
testcase_15 AC 974 ms
97,408 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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(j):
    def g(k):
        sa = SA[i]
        sb = SB[j]
        sc = SC[k]
        return sa*j + sb*k + sc*i
    return findMax(g, 0, NC)

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 = 0
for i in range(NA+1):
    ans= max(ans, findMax(f, 0, NB))
print(ans)
0