結果

問題 No.250 atetubouのzetubou
ユーザー nanaenanae
提出日時 2017-03-30 12:33:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,052 ms / 5,000 ms
コード長 749 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 79,936 KB
最終ジャッジ日時 2023-09-21 08:38:35
合計ジャッジ時間 19,568 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,030 ms
79,556 KB
testcase_01 AC 1,036 ms
79,584 KB
testcase_02 AC 1,052 ms
79,588 KB
testcase_03 AC 1,044 ms
79,652 KB
testcase_04 AC 1,043 ms
79,576 KB
testcase_05 AC 1,044 ms
79,652 KB
testcase_06 AC 1,043 ms
79,696 KB
testcase_07 AC 1,021 ms
79,496 KB
testcase_08 AC 1,051 ms
79,648 KB
testcase_09 AC 1,027 ms
79,408 KB
testcase_10 AC 1,048 ms
79,756 KB
testcase_11 AC 1,043 ms
79,688 KB
testcase_12 AC 1,040 ms
79,508 KB
testcase_13 AC 1,047 ms
79,852 KB
testcase_14 AC 1,032 ms
79,936 KB
testcase_15 AC 203 ms
79,376 KB
testcase_16 AC 201 ms
79,328 KB
testcase_17 AC 202 ms
79,380 KB
testcase_18 AC 203 ms
79,416 KB
testcase_19 AC 205 ms
79,228 KB
testcase_20 AC 176 ms
78,984 KB
testcase_21 AC 223 ms
79,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin, setrecursionlimit

setrecursionlimit(10**5)

inf = 10**15 + 1

def calc_comb(n, k, comb):
    if k > n - k:
        k = n - k

    if comb[n][k] > 0:
        return comb[n][k]

    if k == 0 or k == n:
        comb[n][k] = 1
        return comb[n][k]

    comb[n][k] = min(inf, calc_comb(n - 1, k - 1, comb) + calc_comb(n - 1, k, comb))
    return comb[n][k]

def solve():
    comb = [[0]*(3000 + 1) for i in range(3000 + 1)]
    inf = 10**15 + 1

    Q = int(stdin.readline())

    for q in range(Q):
        d, x, t = map(int, stdin.readline().split())
        c = calc_comb(x + d - 1, d - 1, comb)

        if c > t:
            print('ZETUBOU')
        else:
            print('AC')

if __name__ == '__main__':
    solve()
0