QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#437549#8786. The Whole Worlducup-team1004WA 10ms10740kbPython3978b2024-06-09 13:24:492024-06-09 13:24:50

Judging History

你现在查看的是最新测评结果

  • [2024-06-09 13:24:50]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:10740kb
  • [2024-06-09 13:24:49]
  • 提交

answer

T=int(input())
def gcd(n,m):
	if m==0:
		return n
	else:
		return gcd(m,n%m)
def binom(n,m):
	if 0>m or m>n:
		return 0
	else:
		ans=1
		for i in range(m):
			ans=ans*(n-i)//(i+1)
		return ans
while T>0:
	n=int(input())
	x=[0 for i in range(n)]
	y=[0 for i in range(n)]
	for i in range(n):
		x[i],y[i]=map(int,input().split(' '))
	def chk(x,y,k):
		# print("chk",x,y,k)
		a=[[0 for i in range(k+2)] for j in range(n)]
		for i in range(n):
			a[i][k+1]=y[i]
			for j in range(k+1):
				a[i][j]=binom(x[i],j)
		for i in range(min(n,k+1)):
			for j in range(i+1,n):
				while a[j][i]:
					w=a[i][i]//a[j][i]
					for p in range(k+2):
						a[i][p]-=a[j][p]*w
					a[j],a[i]=a[i],a[j]
		for i in range(n):
			g=0
			for j in range(k+1):
				g=gcd(g,a[i][j])
			if g==0:
				if a[i][k+1]!=0:
					return 0
			else:
				if a[i][k+1]%g!=0:
					return 0
		print(a)
		return 1
	ans=0
	while not chk(x,y,ans):
		ans+=1
	print(ans)
	T-=1

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 10ms
memory: 10740kb

input:

2
2
1 0
4 1
3
1 1
4 4
6 6

output:

[[1, 4, 6, 4, 1], [0, -3, -6, -4, -1]]
3
[[1, 6, 6], [0, -1, -1], [0, 0, 0]]
1

result:

wrong output format Expected integer, but "[[1," found