結果
| 問題 |
No.198 キャンディー・ボックス2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-28 23:50:54 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 255 bytes |
| コンパイル時間 | 47 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-07-05 05:09:32 |
| 合計ジャッジ時間 | 1,169 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 4 |
ソースコード
B = int(raw_input())
N = int(raw_input())
C = sorted([int(raw_input()) for i in xrange(N)])
ans = 10**18
for c in C:
b = sum(c - C[i] for i in xrange(N))
if b > B: continue
ans = min(ans, sum(abs(C[i] - c) for i in xrange(N)))
print ans