結果
問題 | No.1433 Two color sequence |
ユーザー | kamome |
提出日時 | 2021-03-19 22:18:43 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 347 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 87,336 KB |
実行使用メモリ | 109,788 KB |
最終ジャッジ日時 | 2023-08-12 02:41:20 |
合計ジャッジ時間 | 4,644 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
75,904 KB |
testcase_01 | AC | 68 ms
71,568 KB |
testcase_02 | AC | 67 ms
71,368 KB |
testcase_03 | TLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
ソースコード
N = int(input()) S = input() a = list(map(int, input().split())) ans=-10**18 for i in range(N): for j in range(i + 1, N): r = 0 b=0 for k in range(i, j + 1): if S[k] == "R": r += a[k] else: b += a[k] ans = max(ans, abs(r - b)) print(ans)