Submission #1396382


Source Code Expand

Copy
mod = 10**9 + 7
n = int(input())
A = [int(i) for i in input().split()]
for i in range(1,n+1):
	l = 0
	if A.count(i) > 1:
		l = i
		p = []
		for j in range(n+1):
			if A[j] == l:
				p.append(j)
		break
	if l:
		break

t = 1
d = 1
for k in range(n+1):

	#t *= (n+1-k)%mod*pow(k+1,mod-2,mod)
	t *= (n+1-k)%mod*(k+1)**(mod-2)%mod
	t %= mod
	if not k:
		print(n)
	elif k <= n+p[0]-p[1]:
		#d *= (n+p[0]-p[1]-k+1)%mod*pow(k,mod-2,mod)
		d *= (n+p[0]-p[1]-k+1)%mod*(k)**(mod-2)%mod
		d %= mod
		print((t - d)%mod)
	else:
		print(t%mod)

Submission Info

Submission Time
Task D - 11
User TAB
Language PyPy3 (2.4.0)
Score 0
Code Size 563 Byte
Status

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
mx.txt
rnd_0.txt
rnd_1.txt
rnd_2.txt
rnd_3.txt
rnd_4.txt
sample1.txt
sample2.txt
sample3.txt