結果

問題 No.198 キャンディー・ボックス2
ユーザー nebukuro09nebukuro09
提出日時 2016-11-01 15:16:53
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 317 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 6,268 KB
最終ジャッジ日時 2023-08-16 12:13:09
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,008 KB
testcase_01 AC 12 ms
5,972 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 12 ms
5,988 KB
testcase_10 AC 12 ms
6,092 KB
testcase_11 AC 11 ms
6,080 KB
testcase_12 AC 12 ms
6,060 KB
testcase_13 WA -
testcase_14 AC 11 ms
6,216 KB
testcase_15 AC 11 ms
6,228 KB
testcase_16 AC 12 ms
6,060 KB
testcase_17 AC 11 ms
5,992 KB
testcase_18 AC 11 ms
5,988 KB
testcase_19 AC 11 ms
6,080 KB
testcase_20 AC 11 ms
6,100 KB
testcase_21 AC 12 ms
6,076 KB
testcase_22 AC 12 ms
6,224 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 12 ms
6,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

B = input()
N = input()
C = [int(raw_input()) for _ in xrange(N)]
avg = sum(C)/N+1
amari, tarinai = 0, float('inf')
if all(C[0]==c for c in C):
    print 0
    exit()
while amari+B < tarinai:
    amari = sum(c-avg for c in C if c > avg)
    tarinai = sum(avg-c for c in C if c < avg)
    avg -= 1
print amari+tarinai
0