QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508158#1176. BinomialkangkunmaWA 735ms11208kbPython3524b2024-08-07 06:20:212024-08-07 06:20:23

Judging History

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

  • [2024-08-07 06:20:23]
  • 评测
  • 测评结果:WA
  • 用时:735ms
  • 内存:11208kb
  • [2024-08-07 06:20:21]
  • 提交

answer

def s(n,l):
	z=[0]*20
	l.sort(reverse=True);a=n
	A=[];c=1
	for i in range(n-1):
		if l[i]==l[i+1]:c+=1
		else:A+=[[l[i],c]];c=1
	A+=[[l[-1],c]];p=0
	for i in range(len(A)):
		a+=A[i][1]**2-A[i][1]
		t=format(A[i][0],'b').zfill(20);m=0
		for j in range(20):
			if t[j]=='0':z[j]+=2**i
			else:m|=z[j]
		u=bin(m)[2::];u=u[::-1]
		a+=p-sum([(u[k]=='1')*A[k][1] for k in range(len(u))])*A[i][1]
		p+=A[i][1]
	return a
for i in range(int(input())):
	n=int(input());l=[*map(int,input().split())]
	print(s(n,l))

詳細信息

Test #1:

score: 100
Accepted
time: 14ms
memory: 10616kb

input:

2
3
1 5 6
3
1 1 1

output:

4
9

result:

ok 2 number(s): "4 9"

Test #2:

score: -100
Wrong Answer
time: 735ms
memory: 11208kb

input:

10
1
1
3321
108907 496886 513637 107549 602502 235745 583320 401703 649106 841450 806050 127630 250786 780434 780387 256680 723365 604626 255396 251497 992405 594166 951810 524404 585892 85571 821715 581042 711296 187617 367585 862536 856196 312147 121285 967957 495031 855565 619680 318939 618420 91...

output:

1
32339
1158
18033
2006
3213
14503
426
88
1191

result:

wrong answer 2nd numbers differ - expected: '38911', found: '32339'