結果

問題 No.1771 A DELETEQ
ユーザー tamatotamato
提出日時 2021-12-06 23:36:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 3,500 ms
コード長 1,023 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 87,428 KB
実行使用メモリ 81,720 KB
最終ジャッジ日時 2023-09-21 16:02:35
合計ジャッジ時間 7,133 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
80,912 KB
testcase_01 AC 86 ms
81,088 KB
testcase_02 AC 257 ms
81,384 KB
testcase_03 AC 85 ms
81,004 KB
testcase_04 AC 257 ms
81,492 KB
testcase_05 AC 257 ms
81,380 KB
testcase_06 AC 85 ms
80,696 KB
testcase_07 AC 86 ms
80,796 KB
testcase_08 AC 87 ms
80,968 KB
testcase_09 AC 100 ms
81,364 KB
testcase_10 AC 103 ms
81,540 KB
testcase_11 AC 103 ms
81,192 KB
testcase_12 AC 103 ms
81,216 KB
testcase_13 AC 100 ms
81,396 KB
testcase_14 AC 130 ms
81,388 KB
testcase_15 AC 139 ms
81,176 KB
testcase_16 AC 170 ms
81,272 KB
testcase_17 AC 92 ms
81,080 KB
testcase_18 AC 99 ms
81,448 KB
testcase_19 AC 92 ms
81,320 KB
testcase_20 AC 118 ms
81,644 KB
testcase_21 AC 93 ms
81,368 KB
testcase_22 AC 106 ms
81,360 KB
testcase_23 AC 107 ms
81,664 KB
testcase_24 AC 94 ms
81,416 KB
testcase_25 AC 94 ms
81,536 KB
testcase_26 AC 112 ms
81,720 KB
testcase_27 AC 97 ms
81,644 KB
testcase_28 AC 94 ms
81,640 KB
evil_hand_1.txt RE -
evil_hand_2.txt RE -
evil_hand_3.txt RE -
evil_random_1.txt RE -
evil_random_2.txt RE -
evil_random_3.txt RE -
evil_random_4.txt RE -
evil_random_5.txt RE -
evil_random_6.txt RE -
evil_random_7.txt RE -
evil_random_8.txt RE -
evil_random_9.txt RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    # comb init
    nmax = 2 * 10 ** 5 + 10  # change here
    fac = [0] * nmax
    finv = [0] * nmax
    inv = [0] * nmax
    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1
    for i in range(2, nmax):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod

    def comb(n, r):
        if n < r:
            return 0
        else:
            return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod

    pow2 = [1] * 4001
    for i in range(4000):
        pow2[i+1] = (pow2[i] * 2)%mod

    x, y = map(int, input().split())
    assert x <= 4000 and y <= 4000
    if x > y:
        x, y = y, x

    ans = 0
    for i in range(x+1):
        for j in range(i+1):
            ans = (ans + ((comb(x + y - 2 * i + j, j) * comb(x + y - 2 * i, x - i))%mod * pow2[j])%mod)%mod
    print(ans)


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