結果

問題 No.733 分身並列コーディング
ユーザー takana-sky07takana-sky07
提出日時 2019-05-26 16:18:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 961 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 74,552 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 17:56:44
合計ジャッジ時間 2,849 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,348 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
4,348 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
* 733_sample.cpp
* 
* No.733 gR[fBO
*/

#include <iostream>
#include <vector>

using V = std::vector<int>;

int pattern(const V& times, const int& time, const int& num, const int& first) {
	auto times2 = times;
	for (auto i = first; i < num-1; i++) {
		for (auto j = i+1; j < num; j++) {
			if (times2[j] > 0) {
				auto tmp = times2[i] + times2[j];
				if (time >= tmp) {
					times2[i] = tmp;
					times2[j] = -1;
				}
			}
		}
	}
	
	auto count = 0;
	for (auto i = 0; i < num; i++) {
		if (times2[i] > 0) {
			count++;
		}
	}
	return count;
}

int main () {
	auto time = 0;
	auto num = 0;
	std::cin >> time >> num;
	V times(num);
	for (auto i = 0; i < num; i++) {
		std::cin >> times[i];
	}
	
	int ans = num;
	for (auto i = 0; i < num-1; i++) {
		auto count = pattern(times, time, num, i);
		if (ans > count) {
			ans = count;
		}
	}
	
	std::cout << ans << std::endl;
	
	return 0;
	
}
0