Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #8103573

Source Code Expand

Copy
```import collections
mod = 10**9+7
fac = [1]
caf = [1]
n=int(input())

def pow(n,p):
res=1
while p >0:
if p%2==0:
n = n**2 % mod
p //= 2
else:
res = res * n % mod
p -= 1
return res % mod

for i in range(1,n+2):
fac.append((fac[i-1]*i)%mod)
caf.append(pow(fac[i],mod-2)%mod)

def ncr(n,r):
if n < r: return 0
return fac[n]*caf[r]*caf[n-r]

def main():
global n
a=list(map(int,input().split()))

ca= collections.Counter(a)
tyo= ca.most_common()[0][0]
kaburi=[i for i, x in enumerate(a) if x == tyo]

for i in range(1,n+2):
print((ncr(n+1,i)-ncr(n+1-(kaburi[1]-kaburi[0]+1),i-1))%mod)

main()
```

#### Submission Info

Submission Time 2019-10-24 13:11:48+0900 D - 11 hatamura5121 Python3 (3.4.3) 0 749 Byte TLE 2018 ms 29884 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt
All 0 / 600 1.txt, mx.txt, rnd_0.txt, rnd_1.txt, rnd_2.txt, rnd_3.txt, rnd_4.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt 2018 ms 29884 KB
mx.txt 1985 ms 29884 KB
rnd_0.txt 1649 ms 23096 KB
rnd_1.txt 1420 ms 20420 KB
rnd_2.txt 407 ms 8292 KB
rnd_3.txt 353 ms 7724 KB
rnd_4.txt 608 ms 10960 KB
sample1.txt 20 ms 3316 KB
sample2.txt 20 ms 3316 KB
sample3.txt 21 ms 3316 KB