QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#596788 | #4276. Balls and Holes | atgc | WA | 1ms | 3928kb | C++23 | 619b | 2024-09-28 16:26:55 | 2024-09-28 16:26:55 |
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;
int ans=0;
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-1;
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 pr=50;
int x=S[i];
bitset<maxn>ok;
while(x){
int c=__lg(x);
// deb(c);
ok^=hadva[c][pr-1];
pr=c;x^=1ll<<c;
}
ok[i]=0;
ans+=ok.count();
}
// deb(i);
cout<<ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3928kb
input:
2 1 1 2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3924kb
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: 3884kb
input:
2 1 1 1 2
output:
0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'