結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-10 18:05:02 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 433 bytes |
| 記録 | |
| コンパイル時間 | 507 ms |
| コンパイル使用メモリ | 96,836 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-29 12:47:03 |
| 合計ジャッジ時間 | 1,928 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
int L, N;
std::cin >> L >> N;
std::vector<int> W(N);
for (int i = 0; i < N; i++) { std::cin >> W[i]; };
std::sort(W.begin(), W.end());
int ans = 0;
int width_sum = 0;
for (auto &w: W) {
width_sum += w;
if (width_sum > L) {
break;
};
ans++;
}
std::cout << ans << std::endl;
}