結果
問題 |
No.1433 Two color sequence
|
ユーザー |
|
提出日時 | 2021-05-19 12:14:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 311 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 27,096 KB |
最終ジャッジ日時 | 2024-10-09 16:34:27 |
合計ジャッジ時間 | 5,388 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 20 |
ソースコード
from itertools import combinations N = int(input()) S = input() A = list(map(int, input().split())) Sum = [0] * (N+1) for i in range(N): Sum[i+1] = Sum[i] + (A[i] if S[i] == 'R' else -A[i]) Max = 0 for l, r in combinations(range(N+1), 2): Max = max(Max, abs(Sum[l] - Sum[r])) print(Max)