結果

問題 No.250 atetubouのzetubou
ユーザー masamasa
提出日時 2015-09-23 17:26:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 826 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 66,828 KB
実行使用メモリ 73,572 KB
最終ジャッジ日時 2023-09-26 14:37:18
合計ジャッジ時間 3,544 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
73,512 KB
testcase_01 AC 61 ms
73,568 KB
testcase_02 AC 75 ms
73,320 KB
testcase_03 AC 77 ms
73,564 KB
testcase_04 AC 74 ms
73,356 KB
testcase_05 AC 74 ms
73,332 KB
testcase_06 AC 72 ms
73,424 KB
testcase_07 AC 66 ms
73,360 KB
testcase_08 AC 74 ms
73,440 KB
testcase_09 AC 70 ms
73,548 KB
testcase_10 AC 74 ms
73,344 KB
testcase_11 AC 70 ms
73,564 KB
testcase_12 AC 74 ms
73,424 KB
testcase_13 AC 67 ms
73,452 KB
testcase_14 AC 60 ms
73,544 KB
testcase_15 AC 77 ms
73,424 KB
testcase_16 AC 77 ms
73,488 KB
testcase_17 AC 76 ms
73,572 KB
testcase_18 AC 77 ms
73,572 KB
testcase_19 AC 77 ms
73,420 KB
testcase_20 AC 59 ms
73,340 KB
testcase_21 AC 61 ms
73,488 KB
権限があれば一括ダウンロードができます

ソースコード

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