結果
| 問題 |
No.1433 Two color sequence
|
| コンテスト | |
| ユーザー |
👑 terry_u16
|
| 提出日時 | 2021-03-19 22:15:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 121 ms / 2,000 ms |
| コード長 | 385 bytes |
| コンパイル時間 | 355 ms |
| コンパイル使用メモリ | 82,324 KB |
| 実行使用メモリ | 102,184 KB |
| 最終ジャッジ日時 | 2024-11-18 22:51:37 |
| 合計ジャッジ時間 | 3,855 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
n = int(input())
s = input()
a = list(map(int, input().split()))
max_score = 0
for sign_r in range(-1, 2, 2):
sign_b = -sign_r
score = 0
for i in range(0, n):
if s[i] == 'R':
score += sign_r * a[i]
else:
score += sign_b * a[i]
max_score = max(max_score, score)
if score < 0:
score = 0
print(max_score)
terry_u16