結果
| 問題 |
No.2424 Josouzai
|
| コンテスト | |
| ユーザー |
👑 potato167
|
| 提出日時 | 2023-08-15 20:57:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 112 ms / 2,000 ms |
| コード長 | 326 bytes |
| コンパイル時間 | 2,020 ms |
| コンパイル使用メモリ | 196,256 KB |
| 最終ジャッジ日時 | 2025-02-16 08:29:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(p) p.begin(),p.end()
#define rep(i,a,b) for(int i=(int)a;i<(int)b;i++)
int main(){
int N,K;
cin>>N>>K;
vector<int> A(N);
rep(i,0,N) cin>>A[i];
sort(all(A));
int ans=0;
rep(i,0,N){
if(A[i]<=K) K-=A[i],ans++;
}
cout<<ans<<" "<<K<<"\n";
}
potato167