結果

問題 No.3130 Twin's Add Max Min Game
ユーザー Yakumo221
提出日時 2025-05-01 05:05:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 82,064 KB
実行使用メモリ 139,508 KB
最終ジャッジ日時 2025-05-01 05:06:07
合計ジャッジ時間 13,952 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 45 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
alist = list(map(int, input().split()))
slist = list(input().split())

alist.sort()
dli = []
for s in slist:
    if s == "add":
        dli.append(0)
    elif s == "max":
        dli.append(1)
    else:
        dli.append(2)

dli.sort()

ans = 0

for i in range(n):
    a = alist[i]
    d = dli[i]

    if d == 0:
        ans = ans + a
    elif d == 1:
        ans = max(ans, a)
    else:
        ans = min(ans, a)

print(ans)
0