結果

問題 No.250 atetubouのzetubou
ユーザー data9824data9824
提出日時 2015-08-14 08:58:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 706 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 59,992 KB
実行使用メモリ 21,232 KB
最終ジャッジ日時 2023-09-25 11:31:47
合計ジャッジ時間 2,705 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
21,028 KB
testcase_01 AC 36 ms
20,976 KB
testcase_02 AC 64 ms
21,080 KB
testcase_03 AC 67 ms
21,008 KB
testcase_04 AC 64 ms
21,092 KB
testcase_05 AC 64 ms
20,968 KB
testcase_06 AC 58 ms
21,140 KB
testcase_07 AC 46 ms
21,140 KB
testcase_08 AC 62 ms
20,976 KB
testcase_09 AC 57 ms
21,016 KB
testcase_10 AC 63 ms
21,220 KB
testcase_11 AC 54 ms
21,184 KB
testcase_12 AC 61 ms
21,036 KB
testcase_13 AC 51 ms
20,976 KB
testcase_14 AC 27 ms
21,004 KB
testcase_15 AC 48 ms
21,088 KB
testcase_16 AC 49 ms
20,996 KB
testcase_17 AC 48 ms
21,232 KB
testcase_18 AC 48 ms
20,960 KB
testcase_19 AC 48 ms
20,988 KB
testcase_20 AC 8 ms
20,884 KB
testcase_21 AC 8 ms
20,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>

using namespace std;

const long long MAX_T = 1000000000000000LL;
long long cache[1501][1501];

long long patterns(int x, int d) {
	if (d == 1) {
		return 1;
	}
	if (cache[x][d] >= 0) {
		return cache[x][d];
	}
	long long result = 0;
	for (int i = 0; i <= x; ++i) {
		result += patterns(x - i, d - 1);
		if (result > MAX_T) {
			result = MAX_T + 1;
			break;
		}
	}
	cache[x][d] = result;
	return result;
}

int main() {
	fill(&cache[0][0], &cache[1500][1500] + 1, -1);
	int q;
	cin >> q;
	for (int i = 0; i < q; ++i) {
		int d, x;
		long long t;
		cin >> d >> x >> t;
		long long p = patterns(x, d);
		cout << (p <= t ? "AC" : "ZETUBOU") << endl;
	}
	return 0;
}
0