結果

問題 No.2495 Three Sets
ユーザー ShirotsumeShirotsume
提出日時 2023-10-06 22:01:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 892 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 146,248 KB
最終ジャッジ日時 2023-10-06 22:01:35
合計ジャッジ時間 5,149 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
74,412 KB
testcase_01 AC 121 ms
74,628 KB
testcase_02 AC 116 ms
74,760 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 115 ms
74,884 KB
testcase_07 WA -
testcase_08 AC 117 ms
74,824 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 115 ms
74,556 KB
testcase_19 AC 249 ms
145,860 KB
testcase_20 AC 247 ms
146,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

na, nb, nc = mi()

a = sorted(li(), reverse=True)
b = sorted(li(), reverse=True)
c = sorted(li(), reverse=True)
A = []
for v in a:
    A.append((v, 'a'))

for v in b:
    A.append((v, 'b'))
for v in c:
    A.append((v, 'c'))

ans = 0
A.sort(key=lambda x: x[0], reverse=True)
sa = 0
sb = 0
sc = 0
aa = 0
bb = 0
cc = 0
for v, c in A:
    if c == 'a':
        if v * bb + sc >= 0:
            sa += v
            aa += 1
    elif c == 'b':
        if v * cc + sa >= 0:
            sb += v
            bb += 1
    else:
        if v * aa + sb >= 0:
            sc += v
            cc += 1
    ans = max(ans, sa * bb + sb * cc + sc * aa)
print(ans)

0