QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#36418 | #1176. Binomial | juwkim | TL | 2028ms | 8980kb | Python3 | 473b | 2022-06-27 16:26:35 | 2022-06-27 16:26:37 |
Judging History
answer
import sys
input = sys.stdin.readline
from collections import Counter
for _ in range(int(input())):
input()
cnt = Counter(map(int, input().split()))
nums = sorted(cnt, reverse=True)
ans = sum(i * i for i in cnt.values())
for i in range(len(nums)-1):
tmp = 0
for j in range(i+1, len(nums)):
if nums[j] == (nums[i] & nums[j]):
tmp += cnt[nums[j]]
ans += cnt[nums[i]] * tmp
print(ans)
詳細信息
Test #1:
score: 100
Accepted
time: 16ms
memory: 8532kb
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: 2028ms
memory: 8980kb
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...