QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508155#1176. BinomialkangkunmaWA 43ms11056kbPython3447b2024-08-07 05:52:062024-08-07 05:52:07

Judging History

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

  • [2024-08-07 05:52:07]
  • 评测
  • 测评结果:WA
  • 用时:43ms
  • 内存:11056kb
  • [2024-08-07 05:52:06]
  • 提交

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;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: 15ms
memory: 10576kb

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: 43ms
memory: 11056kb

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
2651201
62375
1736081
96344
183395
1061272
14896
1185
55495

result:

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