結果

問題 No.250 atetubouのzetubou
ユーザー h_nosonh_noson
提出日時 2016-02-19 16:19:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2,913 ms / 5,000 ms
コード長 891 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 73,196 KB
実行使用メモリ 144,204 KB
最終ジャッジ日時 2023-10-23 18:30:46
合計ジャッジ時間 43,707 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,566 ms
144,144 KB
testcase_01 AC 2,546 ms
143,784 KB
testcase_02 AC 2,607 ms
144,080 KB
testcase_03 AC 2,913 ms
144,176 KB
testcase_04 AC 2,272 ms
144,180 KB
testcase_05 AC 2,537 ms
144,148 KB
testcase_06 AC 2,332 ms
144,176 KB
testcase_07 AC 2,421 ms
143,784 KB
testcase_08 AC 2,876 ms
144,172 KB
testcase_09 AC 2,453 ms
144,144 KB
testcase_10 AC 2,612 ms
144,204 KB
testcase_11 AC 2,428 ms
144,076 KB
testcase_12 AC 2,720 ms
144,188 KB
testcase_13 AC 2,678 ms
144,036 KB
testcase_14 AC 2,522 ms
140,880 KB
testcase_15 AC 35 ms
4,876 KB
testcase_16 AC 35 ms
4,868 KB
testcase_17 AC 35 ms
4,864 KB
testcase_18 AC 35 ms
4,864 KB
testcase_19 AC 35 ms
4,852 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 38 ms
7,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8

map<pair<int,int>,long long> comb;

long long combination(int n, int k) {
    pair<int,int> p {n,k};
    if (n == k || k == 0)
        return 1;
    else if (comb.count(p) > 0)
        return comb[p];
    else {
        long long ret = min(1000000000000001LL,combination(n-1,k) + combination(n-1,k-1));
        comb[p] = ret;
        return ret;
    }
}

int main() {
    int i, j, q;
    cin >> q;
    rep (i,q) {
        int d,x;
        long long t;
        cin >> d >> x >> t;
        if (combination(x+d-1,d-1) <= t)
            cout << "AC" << endl;
        else
            cout << "ZETUBOU" << endl;
    }
    return 0;
}
0