結果

問題 No.412 花火大会
ユーザー kyuridenamidakyuridenamida
提出日時 2016-08-12 22:45:07
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 967 bytes
コンパイル時間 1,439 ms
コンパイル使用メモリ 162,408 KB
実行使用メモリ 816,000 KB
最終ジャッジ日時 2024-04-25 03:25:21
合計ジャッジ時間 4,252 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)

#define int long long

int dp[110][110][110][110] = {};
int V[110];
int N;
int A,B,C;
tuple<int,int,int> f(int a,int b,int c,int p){
	if( a < p ) return tuple<int,int,int>{p,a,b};
	if( b < p ) return tuple<int,int,int>{a,p,b};
	if( c < p ) return tuple<int,int,int>{a,b,p};
	return tuple<int,int,int>{a,b,c};
}
int dfs(int x,int a,int b,int c){
	
	// cout << x << " " << a << " " << b << " " << c << endl;
	if( x == N ) return a >= A and b >= B and c >= C;
	if( x >= N ) return 0;
	if( dp[x][a][b][c] != -1 ) return dp[x][a][b][c];
	
	int X,y,z;
	tie(X,y,z) = f(a,b,c,V[x]);
	return dp[x][a][b][c] = dfs(x+1,X,y,z) + dfs(x+1,a,b,c);
	
	
}



signed main(){
	memset(dp,-1,sizeof(dp));
	cin >> A >> B >> C;
	if( A < B ) swap(A,B);
	if( B < C ) swap(B,C);
	if( A < B ) swap(A,B);
	cin >> N;
	for(int i = 0 ; i < N ; i++) cin >> V[i];
	cout << dfs(0,0,0,0) << endl;
	

	
	
	
}
0