結果
問題 | No.1683 Robot Guidance |
ユーザー | mkawa2 |
提出日時 | 2023-10-04 11:52:08 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,738 bytes |
コンパイル時間 | 329 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 86,140 KB |
最終ジャッジ日時 | 2024-07-26 14:22:09 |
合計ジャッジ時間 | 4,411 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 55 ms
75,392 KB |
testcase_01 | AC | 55 ms
75,520 KB |
testcase_02 | AC | 58 ms
77,696 KB |
testcase_03 | AC | 77 ms
84,096 KB |
testcase_04 | AC | 76 ms
85,120 KB |
testcase_05 | AC | 75 ms
84,224 KB |
testcase_06 | RE | - |
testcase_07 | AC | 72 ms
84,480 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | AC | 57 ms
76,416 KB |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | AC | 61 ms
77,164 KB |
testcase_17 | AC | 58 ms
77,056 KB |
testcase_18 | AC | 57 ms
76,928 KB |
testcase_19 | AC | 59 ms
77,312 KB |
testcase_20 | AC | 56 ms
77,056 KB |
testcase_21 | AC | 65 ms
81,280 KB |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | AC | 58 ms
76,544 KB |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | AC | 63 ms
76,228 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 | 84 ms
84,736 KB |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | AC | 56 ms
75,520 KB |
ソースコード
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)