結果
問題 | No.198 キャンディー・ボックス2 |
ユーザー |
|
提出日時 | 2023-07-08 08:53:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 38 ms / 1,000 ms |
コード長 | 293 bytes |
コンパイル時間 | 575 ms |
コンパイル使用メモリ | 82,508 KB |
実行使用メモリ | 53,756 KB |
最終ジャッジ日時 | 2024-07-22 04:43:32 |
合計ジャッジ時間 | 2,906 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
b = int(input()) n = int(input()) t = [] sum = 0 for i in range(n): a = int(input()) t.append(a) sum += a t.sort() midpos = (n + 1) // 2 dstval = t[midpos - 1] if sum + b < dstval * n: dstval = (sum + b) // n cnt = 0 for i in range(n): cnt += abs(t[i] - dstval) print(cnt)