QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#477973 | #1176. Binomial | kangkunma | TL | 3771ms | 19680kb | Python3 | 375b | 2024-07-14 14:32:50 | 2024-07-14 14:32:50 |
Judging History
answer
def s(l):
B=[[]for _ in range(20)];A=0;N=[0]*1000001;l.sort()
for i in l:
x=i;t=set(l[::])
for j in range(20):
if x%2<1:t&=set(B[j])
B[j]+=[i]*(x%2<1);x//=2
A+=sum([N[k]*(1+(k==i)) for k in t])+1
N[i]+=1
return A
for _ in range(int(input())):
input();l=[*map(int,input().split())];print(s(l))
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 20ms
memory: 18420kb
input:
2 3 1 5 6 3 1 1 1
output:
4 9
result:
ok 2 number(s): "4 9"
Test #2:
score: 0
Accepted
time: 3771ms
memory: 19680kb
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 38911 1158 22249 2006 3213 15043 426 88 1191
result:
ok 10 numbers
Test #3:
score: -100
Time Limit Exceeded
input:
10 1000000 319659 282355 805517 492423 78447 187157 262446 533612 55339 671293 251238 188866 598658 986 776564 371192 215026 344057 213583 577027 674883 552835 500207 727954 489932 483338 232733 115534 570113 151973 327011 625780 642233 103699 19128 835797 38112 153973 826458 967214 835438 460333 55...