結果

問題 No.250 atetubouのzetubou
ユーザー masa
提出日時 2015-09-23 17:26:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 826 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 65,760 KB
実行使用メモリ 73,728 KB
最終ジャッジ日時 2024-07-19 08:48:52
合計ジャッジ時間 3,095 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

typedef vector<long long> VLL;
typedef vector<VLL> VVLL;

VVLL pascal;

const long long INF = 1e16;
const int PASCAL_MAX = 3000;

void make_pascal() {
	pascal.assign(PASCAL_MAX + 1, VLL(PASCAL_MAX + 1, INF));
	pascal[0][0] = 1;

	for (int i = 1; i <= PASCAL_MAX; i++) {
		pascal[i][0] = 1;
		pascal[i][i] = 1;
		for (int j = 1; j < i; j++) {
			pascal[i][j] = min(INF, pascal[i - 1][j - 1] + pascal[i - 1][j]);
		}
	}
}

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	make_pascal();

	int q, d, x;
	long long t;

	cin >> q;
	vector<bool> ok(q);
	for (int i = 0; i < q; i++) {
		cin >> d >> x >> t;
		d--;
		ok[i] = (pascal[d+x][x] <= t);
	}

	for (int i = 0; i < q; i++) {
		cout << (ok[i] ? "AC" : "ZETUBOU") << endl;
	}
	return 0;
}
0