Submission #2703090


Source Code Expand

import math
from scipy.special import comb

def f(x, y, n):
    r = 0
    if x * y < n:
        r = 0
    elif n == 1:
        r =  1 if x*y == 1 else 0
    elif x != 1 and y != 1 and n == 2:
        r = 2
    elif x == 1 and y != 1 and n >= 2 :
        r = math.factorial(y-2)//math.factorial(n-2)
    elif x != 1 and y == 1 and n >= 2:
        r = math.factorial(x-2)//math.factorial(n-2)
    elif x == 2 and y == 2 and n == 3:
        r = 4
    elif x == 2 and y == 2 and n == 4:
        r = 1
    else:
        a = comb(x*y, n, exact=True)
        b = 0
        for x_ in range(x, 0, -1):
            for y_ in range(y, 0, -1):
                if x_ != x or y_ != y:
                    b += (x-x_+1) * (y-y_+1) * f(x_, y_, n)
        r = a - b
    
    return r

R, C = map(int, input().split())
X, Y = map(int, input().split())
D, L = map(int, input().split())

print((f(X, Y, D+L)*(R+1-X)*(C+1-Y)*math.factorial(D+L)//math.factorial(D)//math.factorial(L)) % 1000000007)

Submission Info

Submission Time
Task D - AtCoder社の冬
User sgrsgr
Language Python (3.4.3)
Score 0
Code Size 1010 Byte
Status RE
Exec Time 386 ms
Memory 23512 KB

Judge Result

Set Name sub All
Score / Max Score 0 / 100 0 / 1
Status
RE × 25
RE × 52
Set Name Test Cases
sub 00_sample_01E.txt, 00_sample_02E.txt, 00_sample_03E.txt, test_03E.txt, test_04E.txt, test_07E.txt, test_08E.txt, test_11E.txt, test_12E.txt, test_15E.txt, test_16E.txt, test_19E.txt, test_20E.txt, test_23E.txt, test_24E.txt, test_27E.txt, test_28E.txt, test_31E.txt, test_32E.txt, test_36E.txt, test_37E.txt, test_38E.txt, test_39E.txt, test_45E.txt, test_47E.txt
All 00_sample_01E.txt, 00_sample_02E.txt, 00_sample_03E.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03E.txt, test_04E.txt, test_05.txt, test_06.txt, test_07E.txt, test_08E.txt, test_09.txt, test_10.txt, test_11E.txt, test_12E.txt, test_13.txt, test_14.txt, test_15E.txt, test_16E.txt, test_17.txt, test_18.txt, test_19E.txt, test_20E.txt, test_21.txt, test_22.txt, test_23E.txt, test_24E.txt, test_25.txt, test_26.txt, test_27E.txt, test_28E.txt, test_29.txt, test_30.txt, test_31E.txt, test_32E.txt, test_33.txt, test_34.txt, test_35.txt, test_36E.txt, test_37E.txt, test_38E.txt, test_39E.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45E.txt, test_46.txt, test_47E.txt, test_48.txt
Case Name Status Exec Time Memory
00_sample_01E.txt RE 386 ms 23512 KB
00_sample_02E.txt RE 156 ms 13236 KB
00_sample_03E.txt RE 157 ms 13108 KB
00_sample_04.txt RE 155 ms 13236 KB
test_01.txt RE 156 ms 13364 KB
test_02.txt RE 156 ms 13364 KB
test_03E.txt RE 157 ms 13236 KB
test_04E.txt RE 156 ms 13108 KB
test_05.txt RE 156 ms 13236 KB
test_06.txt RE 156 ms 13108 KB
test_07E.txt RE 157 ms 13240 KB
test_08E.txt RE 157 ms 13364 KB
test_09.txt RE 156 ms 13236 KB
test_10.txt RE 157 ms 13236 KB
test_11E.txt RE 156 ms 13236 KB
test_12E.txt RE 157 ms 13364 KB
test_13.txt RE 156 ms 13236 KB
test_14.txt RE 157 ms 13108 KB
test_15E.txt RE 157 ms 13236 KB
test_16E.txt RE 157 ms 13236 KB
test_17.txt RE 157 ms 13236 KB
test_18.txt RE 156 ms 13236 KB
test_19E.txt RE 156 ms 13236 KB
test_20E.txt RE 157 ms 13236 KB
test_21.txt RE 156 ms 13236 KB
test_22.txt RE 157 ms 13236 KB
test_23E.txt RE 158 ms 15152 KB
test_24E.txt RE 158 ms 13236 KB
test_25.txt RE 156 ms 13108 KB
test_26.txt RE 156 ms 13236 KB
test_27E.txt RE 156 ms 13108 KB
test_28E.txt RE 157 ms 13236 KB
test_29.txt RE 157 ms 13236 KB
test_30.txt RE 156 ms 13236 KB
test_31E.txt RE 157 ms 13236 KB
test_32E.txt RE 156 ms 13364 KB
test_33.txt RE 159 ms 13364 KB
test_34.txt RE 157 ms 13236 KB
test_35.txt RE 157 ms 13364 KB
test_36E.txt RE 156 ms 13236 KB
test_37E.txt RE 157 ms 13364 KB
test_38E.txt RE 158 ms 13236 KB
test_39E.txt RE 157 ms 13364 KB
test_40.txt RE 156 ms 13236 KB
test_41.txt RE 158 ms 13108 KB
test_42.txt RE 156 ms 13108 KB
test_43.txt RE 157 ms 13236 KB
test_44.txt RE 156 ms 13236 KB
test_45E.txt RE 158 ms 13236 KB
test_46.txt RE 156 ms 13236 KB
test_47E.txt RE 156 ms 13364 KB
test_48.txt RE 156 ms 13236 KB