結果
| 問題 |
No.198 キャンディー・ボックス2
|
| コンテスト | |
| ユーザー |
rocoder
|
| 提出日時 | 2017-07-27 10:28:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 365 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-10-10 02:01:33 |
| 合計ジャッジ時間 | 2,134 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 3 |
| other | AC * 2 RE * 24 |
ソースコード
#candi
def ab(num):
if num<0:
num*=-1
return num
B=int(input())
N=int(input())
C=[int(i) for i in input().split()]
C.sort()
M=0
S=0
for j in range(N):
S+=ab(C[0]-C[j])
i=1
M=S
while i <N:
S=0
for j in range(N):
S+=ab(C[i]-C[j])
if S<M:
M=S
j=i
while j+1<N and C[j]==C[j+1]:
j+=1
i=j
print(M)
rocoder