Submission #1515686


Source Code Expand

import math, itertools

def C(n,m):
    f = math.factorial
    return f(n) // (f(m) * f(n - m))

def DL(x,y):
    xy = x * y
    if xy < d + 1:
        return 0
    return C(xy, d) * C(xy - d, l)
    
m = 10**9+7
r,c = map(int,input().split())
x,y = map(int,input().split())
d,l = map(int,input().split())
a = (r-x+1)*(c-y+1)
xy = x * y

if xy == d + l:
    b = C(xy, d) % m

else:
    b = 0
    p = itertools.product
    for us,ds,ls,rs in p([0,1], repeat=4):
        pt = DL(x - ls - rs, y - us - ds)
        if (us + ds + ls + rs) % 2 == 0:
            b += pt
        else:
            b -= pt
            
ans = a * b %m
print(ans)

Submission Info

Submission Time
Task A - AtCoder社の給料
User john_smith
Language Python (3.4.3)
Score 0
Code Size 669 Byte
Status RE
Exec Time 18 ms
Memory 3064 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
RE × 14
Set Name Test Cases
All 00_sample_01.txt, 00_sample_02.txt, test_100.txt, test_14.txt, test_29.txt, test_4.txt, test_42.txt, test_48.txt, test_54.txt, test_59.txt, test_71.txt, test_72.txt, test_84.txt, test_96.txt
Case Name Status Exec Time Memory
00_sample_01.txt RE 18 ms 3064 KB
00_sample_02.txt RE 18 ms 3064 KB
test_100.txt RE 18 ms 3064 KB
test_14.txt RE 18 ms 3064 KB
test_29.txt RE 18 ms 3064 KB
test_4.txt RE 18 ms 3064 KB
test_42.txt RE 18 ms 3064 KB
test_48.txt RE 18 ms 3064 KB
test_54.txt RE 18 ms 3064 KB
test_59.txt RE 18 ms 3064 KB
test_71.txt RE 18 ms 3064 KB
test_72.txt RE 18 ms 3064 KB
test_84.txt RE 18 ms 3064 KB
test_96.txt RE 18 ms 3064 KB