結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー Hoget157Hoget157
提出日時 2017-03-24 23:33:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,684 bytes
コンパイル時間 855 ms
コンパイル使用メモリ 91,096 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 04:23:11
合計ジャッジ時間 2,249 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 10 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 11 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 11 ms
4,376 KB
testcase_19 AC 10 ms
4,376 KB
testcase_20 AC 10 ms
4,376 KB
testcase_21 AC 11 ms
4,376 KB
testcase_22 AC 10 ms
4,380 KB
testcase_23 AC 10 ms
4,376 KB
testcase_24 AC 11 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
 
using namespace std;
 
#define int long long
//typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
//typedef    pair<int,int>      P;
 
const int INF=1e+13;
const double EPS=1e-9;
const int MOD = 1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int cnt[5],comb[100][100] = {};
int gx,gy,k,x[5],y[5],n[5],res = 0;

void dfs(int num){
	if(num == k){
		int xx = 0,yy = 0,sum = 0;
		for(int i = 0;i < k;i++){
			xx += x[i] * cnt[i];
			yy += y[i] * cnt[i];
			sum += cnt[i];
		}
		if(xx != gx || yy != gy) return;
		int plus = 1,now = sum;
		for(int i = 0;i < k;i++){
			plus = plus * comb[now][now - cnt[i]] % MOD;
			now -= cnt[i];
		}
		res = (res + plus) % MOD;
		return;
	}
	for(int i = 0;i <= n[num];i++){
		cnt[num] = i;
		dfs(num + 1);
	}
}

signed main(){
	cin >> gx >> gy >> k;
	for(int i = 0;i < 100;i++){
		comb[i][0] = 1;
		comb[i][i] = 1;
	}
	for(int i = 1;i < 100;i++){
		for(int j = 1;j < i;j++){
			comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
		}
	}
	for(int i = 0;i < k;i++){
		cin >> x[i] >> y[i] >> n[i];
	}
	dfs(0);
	cout << res << endl;
	return 0;
}
0