QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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))
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Memory Limit Exceeded
input:
1 4 2 3 4 3
output:
2