QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#596743 | #4276. Balls and Holes | atgc | WA | 0ms | 3708kb | C++23 | 616b | 2024-09-28 16:22:53 | 2024-09-28 16:22:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5000;
int n;
bitset<maxn>hadva[50][50];
int64_t S[maxn];
signed main() {
ios::sync_with_stdio(0),cin.tie(0);
cin>>n;
for(int i=0;i<n;++i){
int k;cin>>k;
for(int c=0,j;c<k;++c)cin>>j,S[i]|=1ll<<j;
for(int a=0;a<50;++a)
for(int b=a;b<50;++b)
if(S[i]&(((2ll<<b)-1)^((1ll<<a)-1)))
hadva[a][b][i]=1;
}
int ans=0;
for(int i=0;i<n;++i){
int pr=50;
int x=S[i];
bitset<maxn>ok;
while(x){
int c=__lg(x);
ok^=hadva[c][pr-1];
pr=c;x^=1ll<<c;
}
ok[x]=0;
ans+=ok.count();
}
cout<<ans;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
2 1 1 2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
2 2 1 2 2 2 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3652kb
input:
2 1 1 1 2
output:
2
result:
wrong answer 1st numbers differ - expected: '1', found: '2'