結果
| 問題 | No.156 キャンディー・ボックス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-30 12:13:11 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 152 bytes |
| 記録 | |
| コンパイル時間 | 1,160 ms |
| コンパイル使用メモリ | 183,684 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-27 00:53:35 |
| 合計ジャッジ時間 | 2,016 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | main(){int n,m,i;std::cin>>n>>m;int a[n];for(i=n;i;)std::cin>>a[--i];std::sort(a,a+n);while(m>0)m-=a[i++];printf("%d",m?i-1:i);}
| ^~~~
ソースコード
#include<bits/stdc++.h>
main(){int n,m,i;std::cin>>n>>m;int a[n];for(i=n;i;)std::cin>>a[--i];std::sort(a,a+n);while(m>0)m-=a[i++];printf("%d",m?i-1:i);}