結果

問題 No.1433 Two color sequence
ユーザー yuusanlondonyuusanlondon
提出日時 2021-03-19 21:48:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 102,144 KB
最終ジャッジ日時 2024-11-18 21:49:35
合計ジャッジ時間 3,427 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=input()
a=list(map(int,input().split()))
maxi=0
mini=0
curr=0
for i in range(n):
  if s[i]=='R':
    curr+=a[i]
  else:
    curr-=a[i]
  maxi=max(maxi,curr)
  mini=min(mini,curr)
print(maxi-mini)
0