您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 0浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[luogu]P4570 [BJWC2011]元素 线性基排除0

*DDL_GzmBlog 发布时间:2022-03-01 21:15:03 ,浏览量:0

前言

传送门 :

思路

因为没注意范围 1 e 18 1e18 1e18,循环任然用 55 55 55然后就 W A WA WA了

这题和上一题一样,同样使用了线性基排除了集合中异或和为 0 0 0的情况

然后再贪心的从大到小排序即可

MyCode
const int N  = 1e5+10;
ll p[N];
ll ans;
bool XXJ(ll x){
	for(int i = 62;i>=0;i -- ){
		if(!(x>>i)) continue;
		
		if(!p[i]){
			p[i] = x;
			return true;
		}
		
		x ^=p[i];
	}
	return false;
}
void solve()
{
	int n;cin>>n;
	vector a(n);
	for(int i=1;i>number>>val;
		a.pb({val,number});
	}
	sort(all(a),greater());
	for(int i=0;i            
关注
打赏
1657615554
查看更多评论
0.0394s