結果
| 問題 | No.3268 As Seen in Toasters |
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2025-09-12 21:46:28 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 126 ms / 2,000 ms |
| + 553µs | |
| コード長 | 311 bytes |
| 記録 | |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 96,104 KB |
| 実行使用メモリ | 121,856 KB |
| 最終ジャッジ日時 | 2026-07-15 00:36:47 |
| 合計ジャッジ時間 | 7,253 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))
nikoro256