AtCoder Beginner Contest 003

Submission #6902731

Source codeソースコード

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    def comb(a,b):
        if b > a:
            return 0
        return fact[a]*inv[b]*inv[a-b]%mod
    def f(x,y):
        return comb(x*y,k)
    w,h = LI()
    x,y = LI()
    d,l = LI()
    fact = [1]
    for i in range(10000):
        fact.append(fact[-1]*(i+1)%mod)
    inv = [1]*10001
    inv[10000] = pow(fact[10000],mod-2,mod)
    for i in range(10000)[::-1]:
        inv[i] = inv[i+1]*(i+1)%mod
    k = d+l
    ans = f(x,y)-2*f(x-1,y)-2*f(x,y-1)+f(x-2,y)+f(x,y-2)+4*f(x-1,y-1)-2*f(x-2,y-1)-2*f(x-1,y-2)+f(x-2,y-2)
    ans %= mod
    ans *= (w-x+1)*(h-y+1)
    ans *= comb(k,d)
    ans %= mod
    print(ans)
    return

#B
def B():

    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#Solve
if __name__ == "__main__":
    A()

Submission

Task問題 D - AtCoder社の冬
User nameユーザ名 tsumugi
Created time投稿日時
Language言語 PyPy3 (2.4.0)
Status状態 WA
Score得点 0
Source lengthソースコード長 1527 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
sub 0 / 100 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 0 / 1 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01E.txt AC 182 ms 39280 KB
00_sample_02E.txt AC 185 ms 39280 KB
00_sample_03E.txt AC 180 ms 39280 KB
00_sample_04.txt AC 182 ms 39280 KB
test_01.txt AC 178 ms 39280 KB
test_02.txt AC 179 ms 39408 KB
test_03E.txt AC 189 ms 39280 KB
test_04E.txt AC 184 ms 39280 KB
test_05.txt AC 178 ms 39280 KB
test_06.txt AC 179 ms 39280 KB
test_07E.txt AC 180 ms 39280 KB
test_08E.txt AC 180 ms 39280 KB
test_09.txt AC 180 ms 39280 KB
test_10.txt AC 178 ms 39280 KB
test_11E.txt AC 177 ms 39280 KB
test_12E.txt AC 177 ms 39280 KB
test_13.txt AC 176 ms 39280 KB
test_14.txt AC 180 ms 39280 KB
test_15E.txt AC 178 ms 39280 KB
test_16E.txt AC 177 ms 39280 KB
test_17.txt AC 178 ms 39280 KB
test_18.txt AC 177 ms 39280 KB
test_19E.txt AC 176 ms 39280 KB
test_20E.txt AC 179 ms 39280 KB
test_21.txt AC 180 ms 39280 KB
test_22.txt AC 183 ms 39280 KB
test_23E.txt AC 178 ms 39280 KB
test_24E.txt AC 178 ms 39280 KB
test_25.txt AC 177 ms 39280 KB
test_26.txt AC 184 ms 39280 KB
test_27E.txt AC 175 ms 39280 KB
test_28E.txt AC 177 ms 39280 KB
test_29.txt AC 178 ms 39280 KB
test_30.txt AC 177 ms 39280 KB
test_31E.txt AC 175 ms 39280 KB
test_32E.txt AC 177 ms 39280 KB
test_33.txt AC 179 ms 39280 KB
test_34.txt AC 177 ms 39280 KB
test_35.txt AC 177 ms 39280 KB
test_36E.txt AC 175 ms 39280 KB
test_37E.txt AC 178 ms 39280 KB
test_38E.txt AC 177 ms 39280 KB
test_39E.txt WA
test_40.txt AC 179 ms 39280 KB
test_41.txt AC 177 ms 39280 KB
test_42.txt AC 179 ms 39280 KB
test_43.txt AC 182 ms 39280 KB
test_44.txt AC 176 ms 39280 KB
test_45E.txt AC 177 ms 39280 KB
test_46.txt AC 177 ms 39280 KB
test_47E.txt AC 177 ms 39280 KB
test_48.txt AC 182 ms 39280 KB