結果

問題 No.115 遠足のおやつ
ユーザー tonyu0tonyu0
提出日時 2020-03-29 22:11:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 98,344 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 20:00:14
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
using ll = long long;
using namespace std;
constexpr ll INF = 1LL << 60;

int N, D, K;
string dp[1010][10];

int main() {
	cin >> N >> D >> K;
	dp[0][0] = "0";
	for (int i = 1; i < N + 1; ++i) {
		for (int j = 0; j < N + 1; ++j) {
			for (int k = 0; k < K; ++k) {
				if (dp[j][k] == "" || dp[j][k].back() == (char)(i + '0')) continue;
				dp[i + j][k + 1] = dp[j][k] + " " + to_string(i);
			}
		}
	}
	if (dp[D][K] == "") cout << -1;
	else cout << dp[D][K].substr(2);
	cout << endl;
	return 0;
}
0