結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-23 17:52:19 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 3 ms / 5,000 ms |
| + 327µs | |
| コード長 | 471 bytes |
| 記録 | |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 93,120 KB |
| 実行使用メモリ | 9,728 KB |
| 最終ジャッジ日時 | 2026-09-01 18:24:26 |
| 合計ジャッジ時間 | 2,170 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
int main(void)
{
int L, N; std::cin >> L >> N;
std::vector<int> W(N);
int w;
for (int i=0; i<N; i++){
std::cin >> w;
W[i] = w;
};
std::sort(W.begin(), W.end());
int ans = 0;
int width_sum = 0;
for (int w : W){
width_sum += w;
if (width_sum > L){
break;
};
ans++;
}
std::cout << ans << std::endl;
}