QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508157#1176. BinomialkangkunmaWA 42ms11116kbPython3457b2024-08-07 06:00:582024-08-07 06:00:59

Judging History

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

  • [2024-08-07 06:00:59]
  • 评测
  • 测评结果:WA
  • 用时:42ms
  • 内存:11116kb
  • [2024-08-07 06:00:58]
  • 提交

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]+=A[i][1]
			else:m=max(m,z[j])
		a+=(p-m)*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))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 10ms
memory: 10612kb

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: 42ms
memory: 11116kb

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
2654415
62375
1738115
96344
183395
1061526
14896
1185
55495

result:

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