結果
問題 |
No.2424 Josouzai
|
ユーザー |
|
提出日時 | 2023-08-28 20:54:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 1,790 ms |
コンパイル使用メモリ | 170,448 KB |
実行使用メモリ | 5,480 KB |
最終ジャッジ日時 | 2024-12-30 08:48:29 |
合計ジャッジ時間 | 4,665 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); ll n,k; cin>>n>>k; priority_queue<ll,vector<ll>,greater<ll>> pq; for(int i = 0;i<n;i++){ ll tmp; cin>>tmp; pq.push(tmp); } ll sum = 0; while(!pq.empty()&&pq.top()<=k){ k -= pq.top(); pq.pop(); sum++; } cout<<sum<<' '<<k; }