結果

問題 No.3130 Twin's Add Max Min Game
ユーザー 👑 loop0919
提出日時 2025-02-17 01:43:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 117,412 KB
最終ジャッジ日時 2025-02-17 01:53:33
合計ジャッジ時間 10,561 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 46 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N = int(input())
A = sorted(map(int, input().split()))
S = Counter(input().split())

ans = A[N - S["min"] - 1]
A.pop(N - S["min"] - 1)

if S["add"] > 0:
    S["add"] -= 1
else:
    S["max"] -= 1

for a in A:
    if S["add"] > 0:
        ans += a
        S["add"] -= 1
    elif S["max"] > 0:
        ans = max(ans, a)
        S["max"] -= 1
    else:
        ans = min(ans, a)
        break

print(ans)

0