結果

問題 No.198 キャンディー・ボックス2
ユーザー 👑 KazunKazun
提出日時 2020-06-12 03:58:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 259 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 71,776 KB
最終ジャッジ日時 2023-09-06 08:54:09
合計ジャッジ時間 3,777 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,384 KB
testcase_01 AC 69 ms
71,328 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 71 ms
71,236 KB
testcase_10 AC 72 ms
71,136 KB
testcase_11 AC 73 ms
71,588 KB
testcase_12 AC 74 ms
71,336 KB
testcase_13 WA -
testcase_14 AC 72 ms
71,520 KB
testcase_15 AC 71 ms
71,292 KB
testcase_16 AC 70 ms
71,140 KB
testcase_17 AC 72 ms
71,336 KB
testcase_18 AC 72 ms
71,272 KB
testcase_19 AC 71 ms
71,288 KB
testcase_20 AC 72 ms
71,340 KB
testcase_21 AC 72 ms
71,396 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 72 ms
71,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

B=int(input())
N=int(input())
C=[]
for i in range(N):
    C.append(int(input()))

C.sort()

T=10**20
for i in range(min(B+1,N)):
    if i!=0:
        C[i-1]+=1

    U=0
    S=sum(C)
    for j in range(N):
        U+=abs(C[j]-S//N)

    T=min(T,U+i)

print(T)
0