結果
問題 | No.156 キャンディー・ボックス |
ユーザー |
![]() |
提出日時 | 2023-12-12 21:48:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 115 ms / 2,000 ms |
コード長 | 365 bytes |
コンパイル時間 | 1,910 ms |
コンパイル使用メモリ | 196,652 KB |
最終ジャッジ日時 | 2025-02-18 10:34:11 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){int N,M;cin>>N>>M;priority_queue<int,vector<int>,greater<int>>q;for(int i=0;i<N;i++){int c; cin>>c;q.push(c);}while(!q.empty()&&M--){int c=q.top();q.pop();c--;if(c)q.push(c);}cout << N-q.size() << endl;}