結果

問題 No.115 遠足のおやつ
ユーザー zuvizudarzuvizudar
提出日時 2017-06-18 19:23:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,446 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 92,328 KB
実行使用メモリ 8,004 KB
最終ジャッジ日時 2024-04-09 20:07:19
合計ジャッジ時間 2,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,816 KB
testcase_01 AC 3 ms
7,772 KB
testcase_02 WA -
testcase_03 AC 3 ms
7,780 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
7,800 KB
testcase_07 WA -
testcase_08 AC 3 ms
7,656 KB
testcase_09 AC 3 ms
7,528 KB
testcase_10 AC 3 ms
7,728 KB
testcase_11 AC 3 ms
7,864 KB
testcase_12 AC 3 ms
7,756 KB
testcase_13 AC 3 ms
7,540 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 3 ms
7,856 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 3 ms
7,772 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
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 6 ms
7,924 KB
testcase_40 AC 3 ms
7,800 KB
testcase_41 AC 2 ms
7,704 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int N,D,K;
int dp[101][1001][11];
vector<int>now;
vector<int>ans;

int solve(int a,int b,int c){				//n,d,k
	if(dp[a][b][c]!=-1)return dp[a][b][c];
	if(c==K){
		if(b==D){
			if(ans.size()==0)
			ans=now;
			return 1;
		}
		else{
			return 0;
		}
	}
	if(a==N)
		return 0;
	
	int ret=0;
	now.push_back(a+1);
	int use=solve(a+1,b+(a+1),c+1);
	now.pop_back();
	int not_use=solve(a+1,b,c);
	ret=(use||not_use);
	return dp[a][b][c]=ret;

}
int main(){
	cin>>N>>D>>K;
	fill((int*)dp,(int*)dp+101*1001*11,-1);
	if(solve(0,0,0)){
		cout<<"AAA"<<endl;
		for(int i=0;i<ans.size();i++)
			cout<<ans[i];

		cout<<endl;
	}
	else
		cout<<"-1"<<endl;

	return 0;
}
0