結果

問題 No.250 atetubouのzetubou
ユーザー koyumeishikoyumeishi
提出日時 2015-07-24 23:41:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 786 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 77,312 KB
実行使用メモリ 128,444 KB
最終ジャッジ日時 2023-09-22 23:52:12
合計ジャッジ時間 4,505 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
128,272 KB
testcase_01 AC 111 ms
128,116 KB
testcase_02 AC 130 ms
128,176 KB
testcase_03 AC 132 ms
128,276 KB
testcase_04 AC 130 ms
128,252 KB
testcase_05 AC 130 ms
128,204 KB
testcase_06 AC 125 ms
128,184 KB
testcase_07 AC 117 ms
128,176 KB
testcase_08 AC 129 ms
128,116 KB
testcase_09 AC 123 ms
128,116 KB
testcase_10 AC 130 ms
128,180 KB
testcase_11 AC 122 ms
128,276 KB
testcase_12 AC 133 ms
128,232 KB
testcase_13 AC 120 ms
128,192 KB
testcase_14 AC 112 ms
128,116 KB
testcase_15 AC 132 ms
128,196 KB
testcase_16 AC 131 ms
128,168 KB
testcase_17 AC 132 ms
128,336 KB
testcase_18 AC 132 ms
128,168 KB
testcase_19 AC 131 ms
128,116 KB
testcase_20 AC 110 ms
128,444 KB
testcase_21 AC 110 ms
128,160 KB
権限があれば一括ダウンロードができます

ソースコード

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