結果

問題 No.250 atetubouのzetubou
ユーザー MisterMister
提出日時 2020-04-13 11:41:26
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 919 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 76,252 KB
実行使用メモリ 73,720 KB
最終ジャッジ日時 2023-10-24 21:07:47
合計ジャッジ時間 3,262 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
73,720 KB
testcase_01 AC 61 ms
73,720 KB
testcase_02 AC 76 ms
73,720 KB
testcase_03 AC 78 ms
73,720 KB
testcase_04 AC 75 ms
73,720 KB
testcase_05 AC 75 ms
73,720 KB
testcase_06 AC 72 ms
73,720 KB
testcase_07 AC 66 ms
73,720 KB
testcase_08 AC 74 ms
73,720 KB
testcase_09 AC 71 ms
73,720 KB
testcase_10 AC 76 ms
73,720 KB
testcase_11 AC 69 ms
73,720 KB
testcase_12 AC 74 ms
73,720 KB
testcase_13 AC 68 ms
73,720 KB
testcase_14 AC 59 ms
73,720 KB
testcase_15 AC 77 ms
73,720 KB
testcase_16 AC 77 ms
73,720 KB
testcase_17 AC 77 ms
73,720 KB
testcase_18 AC 77 ms
73,720 KB
testcase_19 AC 77 ms
73,720 KB
testcase_20 AC 60 ms
73,720 KB
testcase_21 AC 61 ms
73,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

using lint = long long;

constexpr int X = 3000;
constexpr lint INF = 1LL << 50;

std::vector<std::vector<lint>> comb;

void init() {
    comb = vec(X + 1, vec(X + 1, 0LL));
    comb[0][0] = 1;
    for (int x = 1; x <= X; ++x) {
        for (int y = 0; y <= x; ++y) {
            comb[x][y] = (y > 0 ? comb[x - 1][y - 1] : 0) +
                         (y < x ? comb[x - 1][y] : 0);
            comb[x][y] = std::min(comb[x][y], INF);
        }
    }
}

void solve() {
    int d, x;
    lint t;
    std::cin >> d >> x >> t;

    std::cout << (comb[x + d - 1][d - 1] <= t ? "AC" : "ZETUBOU")
              << std::endl;
}

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

    init();

    int q;
    std::cin >> q;
    while (q--) solve();

    return 0;
}
0