結果

問題 No.115 遠足のおやつ
ユーザー te-shte-sh
提出日時 2017-01-30 12:01:46
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 91,984 KB
実行使用メモリ 37,004 KB
最終ジャッジ日時 2023-09-03 01:00:50
合計ジャッジ時間 3,787 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 6 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 57 ms
19,464 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 5 ms
5,440 KB
testcase_10 AC 6 ms
4,648 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 35 ms
13,748 KB
testcase_16 AC 48 ms
18,836 KB
testcase_17 AC 13 ms
6,460 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 WA -
testcase_22 AC 26 ms
8,592 KB
testcase_23 AC 5 ms
4,376 KB
testcase_24 AC 22 ms
8,032 KB
testcase_25 AC 14 ms
7,216 KB
testcase_26 AC 6 ms
4,376 KB
testcase_27 AC 10 ms
5,440 KB
testcase_28 AC 6 ms
4,384 KB
testcase_29 AC 9 ms
4,980 KB
testcase_30 AC 22 ms
8,036 KB
testcase_31 AC 8 ms
6,408 KB
testcase_32 AC 38 ms
14,260 KB
testcase_33 AC 3 ms
4,376 KB
testcase_34 AC 56 ms
17,852 KB
testcase_35 AC 13 ms
5,456 KB
testcase_36 WA -
testcase_37 AC 40 ms
14,508 KB
testcase_38 WA -
testcase_39 AC 176 ms
35,188 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], d = rd[1], k = rd[2];

  auto dp = new int[][][][](n+1, k+1, d+1);
  dp[0][0][0] = [0];
  foreach (i; 1..n+1)
    foreach (j; 1..k+1)
      foreach (e; 1..d+1) {
        auto c1 = e >= i ? dp[i-1][j-1][e-i] ~ i : [i];
        auto c2 = dp[i-1][j][e];
        if (c1.front == 0) {
          if (!c2.empty)
            dp[i][j][e] = min(c1, c2);
          else
            dp[i][j][e] = c1;
        } else {
          if (!c2.empty)
            dp[i][j][e] = c2;
        }
      }

  auto r = dp[n][k][d];
  if (r.empty)
    writeln(-1);
  else
    writeln(r.drop(1).to!(string[]).join(" "));
}
0