結果
問題 |
No.3268 As Seen in Toasters
|
ユーザー |
![]() |
提出日時 | 2025-09-12 21:46:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 311 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 82,116 KB |
実行使用メモリ | 109,084 KB |
最終ジャッジ日時 | 2025-09-12 23:37:13 |
合計ジャッジ時間 | 5,565 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
N=int(input()) A=list(map(int,input().split())) A.sort() def score(A): ans=0 for i in range(N-1): x,y = A[i],A[i+1] if x<0 and y<0: ans += -x - y else: ans += abs(x-y) return ans score1 = score(A) score2 = score(A[1:]+[A[0]]) print(min(score1,score2))