結果
| 問題 |
No.115 遠足のおやつ
|
| コンテスト | |
| ユーザー |
lll
|
| 提出日時 | 2018-04-21 03:27:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,034 bytes |
| コンパイル時間 | 862 ms |
| コンパイル使用メモリ | 99,992 KB |
| 実行使用メモリ | 13,888 KB |
| 最終ジャッジ日時 | 2024-06-27 05:20:07 |
| 合計ジャッジ時間 | 14,731 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 32 WA * 1 TLE * 1 -- * 6 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = long long;
int N, D, K;
void dfs(vector<int> &v, int cur) {
if (v.size() == K) {
if (accumulate(v.begin(), v.end(), 0) == D) {
for (int i = 0; i < v.size(); i++) {
if (i > 0)
cout << " ";
cout << v[i];
}
cout << endl;
exit(0);
}
return;
}
for (int n = cur; n <= N; n++) {
v.push_back(n);
if (accumulate(v.begin(), v.end(), 0) > D) {
return;
}
dfs(v, n + 1);
v.pop_back();
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
// int N, D, K;
cin >> N >> D >> K;
vector<int> v;
dfs(v, 1);
cout << -1 << endl;
return 0;
}
lll