結果
| 問題 | 
                            No.115 遠足のおやつ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tubo28
                         | 
                    
| 提出日時 | 2014-12-29 00:54:52 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                CE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 2,362 bytes | 
| コンパイル時間 | 919 ms | 
| コンパイル使用メモリ | 61,864 KB | 
| 最終ジャッジ日時 | 2024-11-14 18:57:42 | 
| 合計ジャッジ時間 | 1,566 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:39:20: error: elements of array ‘std::tuple<int, int, int> src [111][111][1111]’ have incomplete type
   39 | tuple<int,int,int> src[111][111][1111];
      |                    ^~~
main.cpp:39:20: error: storage size of ‘src’ isn’t known
main.cpp: In function ‘int main()’:
main.cpp:52:48: error: ‘tie’ was not declared in this scope
   52 |                         src[i+1][j+1][k+i+1] = tie(i,j,k);
      |                                                ^~~
main.cpp:11:1: note: ‘std::tie’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’?
   10 | #include <sstream>
  +++ |+#include <tuple>
   11 | #include <utility>
main.cpp:56:42: error: ‘tie’ was not declared in this scope
   56 |                         src[i+1][j][k] = tie(i,j,k);
      |                                          ^~~
main.cpp:56:42: note: ‘std::tie’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’?
main.cpp:63:9: error: ‘tie’ was not declared in this scope
   63 |         tie(n,k,d) = tie(N,K,D);
      |         ^~~
main.cpp:63:9: note: ‘std::tie’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’?
main.cpp:24:12: error: ‘make_tuple’ was not declared in this scope
   24 | #define mt make_tuple
      |            ^~~~~~~~~~
main.cpp:64:27: note: in expansion of macro ‘mt’
   64 |         while(tie(n,k,d)!=mt(0,0,0)){
      |                           ^~
main.cpp:24:12: note: ‘std::make_tuple’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’?
   24 | #define mt make_tuple
      |            ^~~~~~~~~~
main.cpp:64:27: note: in expansion of macro ‘mt’
   64 |         while(tie(n,k,d)!=mt(0,0,0)){
      |                           ^~
            
            ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
// ちょうどK個
// 価値の和がD個
// iまでで個数jで和をkにできるか?
bool dp[111][111][1111];
tuple<int,int,int> src[111][111][1111];
int N,D,K;
int main(){
    while(cin>>N>>D>>K && N){
        dump(N,D,K);
        memset(dp,0,sizeof(dp));
        dp[0][0][0] = true;
        for(int i=0;i<N;i++){
            for(int j=K;j>=0;j--){
                for(int k=D;k>=0;k--){
                    if(dp[i][j][k]){
                        dp[i+1][j+1][k+i+1] = true;
                        src[i+1][j+1][k+i+1] = tie(i,j,k);
                    }
                    if(dp[i][j][k]){
                        dp[i+1][j][k] = true;
                        src[i+1][j][k] = tie(i,j,k);
                    }
                }
            }
        }
        vi diff;
        int n,k,d;
        tie(n,k,d) = tie(N,K,D);
        while(tie(n,k,d)!=mt(0,0,0)){
            tie(n,k,d) = src[n][k][d];
            if(diff.size()==0 || diff.back()!=d) diff.push_back(d);
        }
        int t = 0;
        if(dp[N][K][D]){
            int n = diff.size();
            vi ans;
            rep(i,n-1){
                int u = diff[n-i-2] - diff[n-i-1];
                ans.push_back(u);
                t += u;
            }
            if(t!=D){
                ans.push_back(D-t);
            }
            rep(i,ans.size()){
                cout << ans[i] << (i!=ans.size()-1 ? " " : "\n");
            }
        }else{
            puts("-1");
        }
    }
}
            
            
            
        
            
tubo28