結果

問題 No.1683 Robot Guidance
ユーザー mkawa2mkawa2
提出日時 2023-10-04 11:52:08
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,738 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 92,680 KB
最終ジャッジ日時 2023-10-04 11:52:17
合計ジャッジ時間 8,765 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
91,656 KB
testcase_01 AC 88 ms
91,576 KB
testcase_02 AC 98 ms
91,680 KB
testcase_03 AC 108 ms
92,592 KB
testcase_04 AC 108 ms
92,360 KB
testcase_05 AC 104 ms
92,556 KB
testcase_06 RE -
testcase_07 AC 107 ms
92,600 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 93 ms
91,844 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 98 ms
91,748 KB
testcase_17 AC 97 ms
91,716 KB
testcase_18 AC 91 ms
91,808 KB
testcase_19 AC 92 ms
91,716 KB
testcase_20 AC 90 ms
91,952 KB
testcase_21 AC 99 ms
91,748 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 99 ms
91,536 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 94 ms
91,868 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 122 ms
92,276 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 AC 89 ms
91,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(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 = -1-(-1 << 31)
inf = -1-(-1 << 63)
md = 10**9+7
# md = 998244353

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

def H(n, r):
    if n == r == 0: return 1
    return nCr(n+r-1, n)

A, B, X, Y = LI()
q, r = divmod(B+1, 4)
cnt = [q]*4
for i in range(r): cnt[i] += 1

# xp-xm=X
# yp-ym=Y
# xp+xm+yp+ym=A

# yp+ym=A-(xp+xm)
# yp=(Y+A-(xp+xm))//2
ans = 0
for xp in range(A+1):
    xm = xp-X
    yp = (Y+A-(xp+xm))//2
    ym = yp-Y
    if not 0 <= xm <= A or (Y+A-(xp+xm))%2 or not 0 <= yp <= A or not 0 <= ym <= A: continue
    ans += H(xp, cnt[0])*H(yp, cnt[1])%md*H(xm, cnt[2])%md*H(ym, cnt[3])%md
    ans %= md

print(ans)
0