60分求助
查看原帖
60分求助
97277
APTX__4869楼主2020/12/1 20:56

RT,先不管特判的分

我错了#13-#20

看不出来为什么求大佬讲解。

#include<bits/stdc++.h>
using namespace std;
long long n,m,k,t,x,y,p,c,i,j;
long long ans;
long long a[1000005],b[100005];
int main()
{
  
  //ios::sync_with_stdio(true);
  //cin>>n>>m>>c>>k;
  scanf("%d%d%d%d",&n,&m,&c,&k);
  for (i=1;i<=n;i++)
    {
	//cin>>x;
	scanf("%d",&x);
    if (i==1) t=x; else t=(t|x);
	}	
  for (i=0;i<=k-1;i++)	
    {
     a[i]=t%2; 	
     t=t/2; 
	}
for (i=0;i<=k-1;i++) b[i]=true;	
  for (i=1;i<=m;i++)
    {
	cin>>x>>y;	
    if (a[x]==0&&b[x]) {b[x]=false;p++;}
	}
ans=1;	
for (i=1;i<=k-p;i++)	
  ans=ans*2;
cout<<ans-n;  
//printf("%lld",ans);	
  return 0;	
}
2020/12/1 20:56
加载中...