結果

問題 No.250 atetubouのzetubou
ユーザー koyumeishi
提出日時 2015-07-24 23:41:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 786 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 77,896 KB
実行使用メモリ 128,384 KB
最終ジャッジ日時 2024-07-16 00:26:50
合計ジャッジ時間 4,202 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

int main(){
	int q;
	cin >> q;

	vector<vector<long long>> dp(4000, vector<long long>(4000,0));
	dp[0][0] = 1;
	for(int i=1; i<4000; i++){
		for(int j=0; j<=i; j++){
			if((dp[i-1][j] < 0) || (j>0 && dp[i-1][j] < 0) ){
				dp[i][j] = -1;
				continue;
			}

			dp[i][j] = dp[i-1][j] + (j>0?dp[i-1][j-1]:0);
			if(dp[i][j] >= 1e18) dp[i][j] = -1;
		}
	}

	while(q--){
		long long d,x;
		long long t;
		cin >> d >> x >> t;

		//cerr << dp[d+x-1][x] << endl;
		if(dp[d+x-1][x] >= 0 && dp[d+x-1][x] <= t){
			cout << "AC" << endl;
		}else{
			cout << "ZETUBOU" << endl;
		}

	}
	return 0;
}
0