QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#752418 | #858. GCD vs. XOR | kangkunma | WA | 2370ms | 114488kb | Python3 | 477b | 2024-11-16 02:31:43 | 2024-11-16 02:31:44 |
Judging History
answer
D=[[] for _ in range(1000001)];x=0
for i in range(1000):
for j in range(i+1,1000000//(1+i)):D[(i+1)*j]+=[i+1]*((i+1+j)==j|(1+i))
def s(l):
C=[0]*1000001;A=0
for i in l:C[i]+=1
for i in set(l):
for j in D[i]:
if i+j>1000000:break
A+=C[i]*C[j+i]
if i//j+i<=1000000:A+=C[i]*C[i//j+i]*((i+i//j)==(i//j)|i)*(j**2!=i)
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: 100
Accepted
time: 2370ms
memory: 114488kb
input:
1 4 2 3 4 3
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: -100
Wrong Answer
time: 2306ms
memory: 114484kb
input:
20 43 128 66 452 384 400 441 232 203 228 33 284 156 128 190 197 292 388 31 179 343 147 206 450 284 180 73 273 130 168 250 405 203 235 340 309 28 267 395 152 191 295 463 344 54 48 7 12 37 49 24 5 18 15 37 26 57 53 59 22 10 2 16 36 52 64 1 56 42 38 46 53 7 2 8 60 38 54 11 19 50 20 61 6 50 27 5 26 3 4 ...
output:
7 49 12 6 8 29 46 12 2 96 5 5 30 1 2 9 7 286 17 0
result:
wrong answer 1st numbers differ - expected: '9', found: '7'