結果

問題 No.115 遠足のおやつ
ユーザー assy1028assy1028
提出日時 2016-12-19 20:51:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,756 bytes
コンパイル時間 960 ms
コンパイル使用メモリ 101,128 KB
実行使用メモリ 41,908 KB
最終ジャッジ日時 2023-08-21 01:19:29
合計ジャッジ時間 9,243 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
41,548 KB
testcase_01 AC 15 ms
41,644 KB
testcase_02 AC 16 ms
41,516 KB
testcase_03 AC 16 ms
41,552 KB
testcase_04 WA -
testcase_05 AC 16 ms
41,556 KB
testcase_06 AC 17 ms
41,656 KB
testcase_07 AC 26 ms
41,520 KB
testcase_08 AC 18 ms
41,580 KB
testcase_09 AC 43 ms
41,708 KB
testcase_10 AC 62 ms
41,548 KB
testcase_11 AC 16 ms
41,616 KB
testcase_12 AC 152 ms
41,600 KB
testcase_13 AC 16 ms
41,524 KB
testcase_14 AC 20 ms
41,540 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 219 ms
41,548 KB
testcase_19 WA -
testcase_20 AC 17 ms
41,576 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 18 ms
41,616 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 59 ms
41,564 KB
testcase_27 WA -
testcase_28 AC 37 ms
41,572 KB
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 WA -
testcase_38 WA -
testcase_39 AC 332 ms
41,644 KB
testcase_40 AC 17 ms
41,552 KB
testcase_41 AC 16 ms
41,624 KB
testcase_42 AC 16 ms
41,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, d, k;

string memo[110][1010][11];

string calc(int a, int b, int c) {
    if (a > n) {        
        return (b==0&&c==0?"":"-");
    }
    if (memo[a][b][c].size() == 0) {
        string s = calc(a+1, b-a, c-1);
        stringstream ss;
        if (s.size() == 0 || s[0] != '-') {
            ss << a << ' ' << s;
            memo[a][b][c] = ss.str();
        } else memo[a][b][c] = calc(a+1, b, c);
    }
    return memo[a][b][c];
}

string solve() {
    string ret =  calc(1, d, k);
    return (ret[0]=='-'?"-1":ret);
}

void input() {
    cin >> n >> d >> k;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}
0