求助,在本地运行能过第15测试点,但在洛谷上不行
查看原帖
求助,在本地运行能过第15测试点,但在洛谷上不行
462050
Misakura_Rin楼主2022/8/17 22:24
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
typedef unsigned long long ull;
ull n,m,c,k;
ull hg=0;//have get
ull _cg=0;//cant get
ull ans=0;
int cgw=0;
int main(){
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
	scanf("%llu%llu%llu%llu",&n,&m,&c,&k);
	for(int i=1;i<=n;i++){
		ull a;
		scanf("%llu",&a);
		hg|=a;
	}
	for(int i=1;i<=m;i++){
		int A,B;
		scanf("%d%d",&A,&B);
		ull pa=pow(2,A);
		if(!(pa&hg)){
			_cg|=pa;
		}
	}
	while(_cg!=0){
		if(_cg&1)cgw++;
		_cg>>=1;
	}
	int nw=k-cgw;
	ans=pow(2,nw-1)-n+pow(2,nw-1);
	//if(ans==18014398509177476)ans--;
	if(nw==64)printf("18446744073709551616");
	else printf("%llu",ans);
	return 0;
}

如果不加35行的特判第15个点就会WA,但我在本地运行结果是正确的

2022/8/17 22:24
加载中...