結果

問題 No.3130 Twin's Add Max Min Game
コンテスト
ユーザー 👑 loop0919
提出日時 2025-02-17 01:43:25
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 435 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 206 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 117,888 KB
最終ジャッジ日時 2026-07-02 12:40:16
合計ジャッジ時間 8,342 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 46 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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