結果
問題 | No.3103 Butterfly Effect |
ユーザー |
![]() |
提出日時 | 2025-04-15 21:45:01 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 448 bytes |
コンパイル時間 | 407 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 65,732 KB |
最終ジャッジ日時 | 2025-04-15 21:46:11 |
合計ジャッジ時間 | 7,763 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)