結果
問題 |
No.3103 Butterfly Effect
|
ユーザー |
![]() |
提出日時 | 2025-04-16 15:35:43 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 448 bytes |
コンパイル時間 | 622 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 64,896 KB |
最終ジャッジ日時 | 2025-04-16 15:40:32 |
合計ジャッジ時間 | 7,632 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | RE * 50 |
ソースコード
n = int(input()) a = list(map(int, input().split())) if n == 0: print(0) exit() left_max = [0] * n left_max[0] = a[0] for i in range(1, n): left_max[i] = max(left_max[i-1], a[i]) right_max = [0] * n right_max[-1] = a[-1] for i in range(n-2, -1, -1): right_max[i] = max(right_max[i+1], a[i]) total = 0 for i in range(n): current_max = max(left_max[i], right_max[i]) total += max(abs(a[i]), abs(current_max)) print(total)