結果

問題 No.1771 A DELETEQ
ユーザー mkawa2mkawa2
提出日時 2021-12-16 14:30:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,070 ms / 3,500 ms
コード長 1,519 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 92,332 KB
最終ジャッジ日時 2023-10-11 12:16:39
合計ジャッジ時間 16,100 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
91,416 KB
testcase_01 AC 94 ms
91,636 KB
testcase_02 AC 2,070 ms
92,332 KB
testcase_03 AC 92 ms
91,640 KB
testcase_04 AC 2,066 ms
92,296 KB
testcase_05 AC 2,049 ms
92,060 KB
testcase_06 AC 93 ms
91,832 KB
testcase_07 AC 94 ms
91,428 KB
testcase_08 AC 95 ms
91,612 KB
testcase_09 AC 158 ms
91,956 KB
testcase_10 AC 188 ms
92,088 KB
testcase_11 AC 196 ms
91,752 KB
testcase_12 AC 206 ms
91,996 KB
testcase_13 AC 159 ms
91,816 KB
testcase_14 AC 502 ms
91,812 KB
testcase_15 AC 593 ms
92,332 KB
testcase_16 AC 959 ms
92,256 KB
testcase_17 AC 103 ms
91,972 KB
testcase_18 AC 148 ms
92,168 KB
testcase_19 AC 100 ms
92,028 KB
testcase_20 AC 364 ms
92,204 KB
testcase_21 AC 111 ms
92,216 KB
testcase_22 AC 237 ms
92,160 KB
testcase_23 AC 237 ms
92,296 KB
testcase_24 AC 126 ms
92,132 KB
testcase_25 AC 116 ms
92,116 KB
testcase_26 AC 299 ms
92,176 KB
testcase_27 AC 139 ms
92,308 KB
testcase_28 AC 110 ms
91,920 KB
evil_hand_1.txt WA -
evil_hand_2.txt WA -
evil_hand_3.txt WA -
evil_random_1.txt WA -
evil_random_2.txt WA -
evil_random_3.txt WA -
evil_random_4.txt WA -
evil_random_5.txt WA -
evil_random_6.txt WA -
evil_random_7.txt WA -
evil_random_8.txt WA -
evil_random_9.txt WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 18446744073709551615
# inf = 4294967295
# md = 10**9+7
md = 998244353

def nHr(hn, hr):
    return nCr(hn+hr-1, hr-1)

def nPr(com_n, com_r):
    if com_r < 0: return 0
    if com_n < com_r: return 0
    return fac[com_n]*ifac[com_n-com_r]%md

def nCr(com_n, com_r):
    if com_r < 0: return 0
    if com_n < com_r: return 0
    return fac[com_n]*ifac[com_r]%md*ifac[com_n-com_r]%md

# 準備
n_max = 200005
fac = [1]
for i in range(1, n_max+1): fac.append(fac[-1]*i%md)
ifac = [1]*(n_max+1)
ifac[n_max] = pow(fac[n_max], md-2, md)
for i in range(n_max-1, 1, -1): ifac[i] = ifac[i+1]*(i+1)%md

x, y = LI()
if x>4000 or y>4000:
    print(-1)
    exit()

lim = min(x, y)

ans = 0
for a in range(lim+1):
    for b in range(lim-a+1):
        ans += nCr(x+y-a-b*2, x-a-b)*nCr(y-b, y-a-b)%md*pow(2, a, md)%md
        ans %= md
        # pDB(a, b, ans)

print(ans)
0