Submission #820013


Source Code Expand

Copy
h, w, a, b = map(int, raw_input().split())
mod = 10**9+7
ans = 0
mod_fact = [1]
for i in range(1,h+w-2):
    mod_fact.append((i*mod_fact[i-1])%mod)
factinv = [1] * (h+w-2)
factinv[h+w-3] = pow(mod_fact[h+w-3],(mod-2),mod)
for i in reversed(range(2,h+w-3)):
    factinv[i] = (factinv[i+1] * (i+1))%mod
def C(n,r):
    return mod_fact[n]*factinv[r]*factinv[n-r]%mod
for i in range(b,w):
    ans += C(i+h-a-1,h-a-1) * C(a-1+w-i-1,a-1) % mod
print ans

Submission Info

Submission Time
Task D - Iroha and a Grid
User kaixiang
Language Python (2.7.6)
Score 0
Code Size 461 Byte
Status WA
Exec Time 467 ms
Memory 21740 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
WA × 1
AC × 7
WA × 19
Set Name Test Cases
Sample subtask0_01.txt, subtask0_02.txt, subtask0_03.txt, subtask0_04.txt
All subtask0_01.txt, subtask0_02.txt, subtask0_03.txt, subtask0_04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_max.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_max.txt
Case Name Status Exec Time Memory
subtask0_01.txt AC 26 ms 2696 KB
subtask0_02.txt AC 26 ms 2696 KB
subtask0_03.txt AC 235 ms 21736 KB
subtask0_04.txt WA 335 ms 21736 KB
subtask1_01.txt WA 26 ms 2696 KB
subtask1_02.txt AC 27 ms 2696 KB
subtask1_03.txt WA 26 ms 2696 KB
subtask1_04.txt WA 26 ms 2696 KB
subtask1_05.txt AC 26 ms 2696 KB
subtask1_06.txt WA 26 ms 2696 KB
subtask1_07.txt WA 26 ms 2696 KB
subtask1_08.txt AC 26 ms 2696 KB
subtask1_09.txt WA 29 ms 2696 KB
subtask1_10.txt AC 27 ms 2696 KB
subtask1_max.txt WA 26 ms 2696 KB
subtask2_01.txt WA 50 ms 4100 KB
subtask2_02.txt WA 44 ms 4348 KB
subtask2_03.txt WA 45 ms 3844 KB
subtask2_04.txt WA 56 ms 4340 KB
subtask2_05.txt WA 47 ms 3972 KB
subtask2_06.txt WA 467 ms 21616 KB
subtask2_07.txt WA 241 ms 21740 KB
subtask2_08.txt WA 365 ms 21616 KB
subtask2_09.txt WA 310 ms 21620 KB
subtask2_10.txt WA 464 ms 21612 KB
subtask2_max.txt WA 69 ms 4580 KB