60 pts WA 求调
查看原帖
60 pts WA 求调
728459
HeYilin楼主2025/7/24 23:39

60 pts , WA on #15~#22 , hack 通过

link : https://www.luogu.com.cn/record/226660138

code :

#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
const int maxn=1e6+10;
int n,m,c,k,a[maxn],x,sum;
map<int,int>mp;
unsigned long long ksm(int a,int b){
	unsigned long long mul=1;
	while(b){
		if(b&1)mul*=a,b--;
		a*=a,b>>=1;
	}
	return mul;
}
int main(){
	cin>>n>>m>>c>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	while(m--){
		int p,q;
		cin>>p>>q;
		mp[p]=1;
	}
	for(int i=0;i<n;i++)x|=a[i];
//	cout<<x<<"\n";
	for(int i=0;i<k;i++)if(!(x&(1<<i))&&mp[i])sum++;
//	cout<<ksm(2,k-sum)<<" ";
	cout<<ksm(2,k-sum)-n;
	return 0;
}
/*
3 3 5 4
1 4 6
0 3
2 4
2 5

*/
2025/7/24 23:39
加载中...