結果
問題 |
No.3103 Butterfly Effect
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:41:20 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,124 KB |
実行使用メモリ | 67,148 KB |
最終ジャッジ日時 | 2025-06-12 18:41:29 |
合計ジャッジ時間 | 6,766 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | RE * 50 |
ソースコード
n = int(input()) a = list(map(int, input().split())) if n == 0: print(0) exit() M = max(a) m = min(a) max_abs = max(abs(M), abs(m)) total = 0 for num in a: if max_abs == abs(M): if abs(num) < abs(M): total += abs(M) else: total += abs(num) else: if num == m: total += abs(m) else: if abs(num) >= abs(m): total += abs(num) else: if abs(M) > abs(num): total += abs(M) else: total += abs(num) print(total)