QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#596743#4276. Balls and HolesatgcWA 0ms3708kbC++23616b2024-09-28 16:22:532024-09-28 16:22:53

Judging History

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

  • [2024-09-28 16:22:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3708kb
  • [2024-09-28 16:22:53]
  • 提交

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'