QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#752394 | #858. GCD vs. XOR | kangkunma | ML | 0ms | 0kb | Python3 | 343b | 2024-11-16 01:47:21 | 2024-11-16 01:47:22 |
answer
D=[[] for _ in range(2000001)];x=0
for i in range(2000000):
for j in range(2000000//(1+i)):
D[i*j]+=[i]
def s(l):
C=[0]*4000001;A=0
for i in l:C[i]+=1
for i in set(l):
for j in D[i]:A+=C[i]*C[j+i]*(i^(i+j)==j)
return A
for i in range(int(input())):input();l=[*map(int,input().split())];print(s(l))
详细
Test #1:
score: 0
Memory Limit Exceeded
input:
1 4 2 3 4 3
output:
2