結果

問題 No.1433 Two color sequence
ユーザー sepa38sepa38
提出日時 2022-12-15 13:36:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,024 KB
実行使用メモリ 115,440 KB
最終ジャッジ日時 2024-04-26 15:23:38
合計ジャッジ時間 4,519 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,696 KB
testcase_01 AC 38 ms
53,584 KB
testcase_02 AC 37 ms
52,564 KB
testcase_03 AC 89 ms
115,440 KB
testcase_04 AC 87 ms
114,972 KB
testcase_05 AC 36 ms
52,608 KB
testcase_06 AC 36 ms
52,004 KB
testcase_07 AC 37 ms
51,944 KB
testcase_08 AC 111 ms
112,924 KB
testcase_09 AC 115 ms
112,816 KB
testcase_10 AC 113 ms
112,036 KB
testcase_11 AC 119 ms
112,960 KB
testcase_12 AC 117 ms
113,180 KB
testcase_13 AC 118 ms
112,796 KB
testcase_14 AC 112 ms
112,868 KB
testcase_15 AC 113 ms
112,868 KB
testcase_16 AC 113 ms
113,264 KB
testcase_17 AC 114 ms
112,972 KB
testcase_18 AC 114 ms
113,108 KB
testcase_19 AC 112 ms
112,740 KB
testcase_20 AC 112 ms
112,744 KB
testcase_21 AC 113 ms
112,620 KB
testcase_22 AC 113 ms
112,996 KB
testcase_23 AC 113 ms
112,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
a = list(map(int, input().split()))
ls = [0]
for i in range(n):
  ls.append(ls[-1])
  if s[i] == "R":
    ls[-1] += a[i]
  else:
    ls[-1] -= a[i]
print(max(ls) - min(ls))
0