結果
問題 | No.1433 Two color sequence |
ユーザー |
|
提出日時 | 2021-05-19 12:51:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 466 ms / 2,000 ms |
コード長 | 266 bytes |
コンパイル時間 | 408 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 32,932 KB |
最終ジャッジ日時 | 2024-10-09 17:01:10 |
合計ジャッジ時間 | 9,924 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
N = int(input())S = input()A = list(map(int, input().split()))res = 0maxs, mins = 0, 0for i in range(N):v = A[i] if S[i] == 'R' else -A[i]maxs = max(maxs + v, v)mins = min(mins + v, v)res = max(res, abs(maxs), abs(mins))print(res)