結果
| 問題 |
No.156 キャンディー・ボックス
|
| コンテスト | |
| ユーザー |
chacoder1
|
| 提出日時 | 2021-03-13 11:55:00 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 318 bytes |
| コンパイル時間 | 7,921 ms |
| コンパイル使用メモリ | 255,376 KB |
| 最終ジャッジ日時 | 2025-01-19 16:05:36 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 25 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int>P;
int main(){
int n,m;
cin>>n>>m;
int b[n];
rep(i,n){
cin>>b[i];
}
sort(b,b+n);
int cnt=0;
while(m>=0){
m-=b[cnt];
cnt++;
}
cout<<cnt-1<<endl;
return 0;
}
chacoder1