結果

問題 No.250 atetubouのzetubou
ユーザー femtofemto
提出日時 2016-01-16 18:29:18
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 792 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 61,004 KB
実行使用メモリ 198,356 KB
最終ジャッジ日時 2023-10-20 00:21:20
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
198,356 KB
testcase_01 AC 56 ms
198,356 KB
testcase_02 AC 71 ms
198,356 KB
testcase_03 AC 69 ms
198,356 KB
testcase_04 AC 67 ms
198,356 KB
testcase_05 AC 68 ms
198,356 KB
testcase_06 AC 65 ms
198,356 KB
testcase_07 AC 58 ms
198,356 KB
testcase_08 AC 66 ms
198,356 KB
testcase_09 AC 63 ms
198,356 KB
testcase_10 AC 67 ms
198,356 KB
testcase_11 AC 62 ms
198,356 KB
testcase_12 AC 66 ms
198,356 KB
testcase_13 AC 60 ms
198,356 KB
testcase_14 AC 54 ms
198,356 KB
testcase_15 AC 69 ms
198,356 KB
testcase_16 AC 70 ms
198,356 KB
testcase_17 AC 69 ms
198,356 KB
testcase_18 AC 69 ms
198,356 KB
testcase_19 AC 68 ms
198,356 KB
testcase_20 AC 52 ms
198,352 KB
testcase_21 AC 53 ms
198,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
const int SIZE = 5000;
const ll MAX = ll(1e15);
ll c[SIZE][SIZE];

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

	c[0][0] = 1;
	for(int i = 1; i < SIZE; i++) {
		for(int j = 0; j <= i; j++) {
			if(j == 0 || i == j) {
				c[i][j] = 1;
			}
			else if(c[i - 1][j - 1] == -1 || c[i - 1][j] == -1) {
				c[i][j] = -1;
			}
			else {
				c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
				if(c[i][j] >= MAX)
					c[i][j] = -1;
			}
		}
	}

	ll q;
	cin >> q;
	for(int loop = 0; loop < q; loop++) {
		ll d, x, t;
		cin >> d >> x >> t;
		if(c[x + d - 1][d - 1] > t || c[x + d - 1][d - 1] == -1) {
			cout << "ZETUBOU" << endl;
		}
		else {
			cout << "AC" << endl;
		}
	}
}

0