QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#544730#1176. Binomialship2077WA 146ms12068kbC++14644b2024-09-02 19:48:362024-09-02 19:48:36

Judging History

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

  • [2024-09-02 19:48:36]
  • 评测
  • 测评结果:WA
  • 用时:146ms
  • 内存:12068kb
  • [2024-09-02 19:48:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=(1<<20)+5;
int n,a[M],b[M];
int read(){
    int x=0;char ch=getchar();
    while (!isdigit(ch)) ch=getchar();
    while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
    return x;
}
void solve(){ n=read();
    for (int i=0;i<1<<20;i++) a[i]=b[i]=0;
    for (int i=1;i<=n;i++){
        int x=read();a[x]++;b[x]++;
    } long long ans=0;
    for (int i=0;i<20;i++)
        for (int j=0;j<1<<20;j++)
            if (j>>i&1) b[j]+=b[j^1<<i];
    for (int i=0;i<20;i++) ans+=1ll*a[i]*b[i];
    printf("%lld\n",ans);
}
int main(){int T=read();while (T--) solve();return 0;}

详细

Test #1:

score: 100
Accepted
time: 27ms
memory: 12068kb

input:

2
3
1 5 6
3
1 1 1

output:

4
9

result:

ok 2 number(s): "4 9"

Test #2:

score: -100
Wrong Answer
time: 146ms
memory: 12000kb

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

result:

wrong answer 2nd numbers differ - expected: '38911', found: '0'