結果

問題 No.156 キャンディー・ボックス
ユーザー a_ten
提出日時 2016-03-23 19:21:31
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 234 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 13,348 KB
最終ジャッジ日時 2024-10-01 21:37:24
合計ジャッジ時間 11,117 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding:utf-8

from heapq import heapify,heappop,heappush

N,M=map(int,raw_input().split())
C=map(int,raw_input().split())
C1=C

heapify(C)

cnt=0
while M:
	s=heappop(C)
	s-=1
	M-=1
	if s!=0:
		heappush(C,s)
	else:
		cnt+=1

print cnt
0