QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#477962#1176. BinomialkangkunmaTL 2356ms21912kbPython3443b2024-07-14 14:17:212024-07-14 14:17:21

Judging History

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

  • [2024-07-14 14:17:21]
  • 评测
  • 测评结果:TL
  • 用时:2356ms
  • 内存:21912kb
  • [2024-07-14 14:17:21]
  • 提交

answer

def s(l):
    B=[[]for _ in range(20)];A=0;N=[0]*1000001
    for i in l:
        x=i;N[i]+=1
        for j in range(20):B[j]+=[i]*(x%2<1);x//=2
    for i in range(20): B[i]=set(B[i])
    for i in l:
        x=i;t=set(l[::])
        for j in range(20):
            if x%2<1:t&=B[j]
            x//=2
        A+=sum([N[k] for k in t])
    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: 7ms
memory: 18392kb

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: 2356ms
memory: 21912kb

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...

output:


result: