P7076求救,急急急
查看原帖
P7076求救,急急急
858551
SkylandRedstone楼主2024/7/23 18:07

照着题解思路捋了一遍,仍然60分

#include<bits/stdc++.h>
using namespace std;
int n, m, c, k, p, q, cnt;
unsigned long long a;
bool vis[65], dis[65];
int main(){
	cin >> n >> m >> c >> k;
	for(int i = 1; i <= n; ++i){
		cin >> a;
		for(unsigned long long j = 0; (1 << j) <= a; ++j)
			vis[j] = a & (1 << j);
}
	for(int i = 1; i <= m; ++i){
		cin >> p >> q;
		if(!vis[p] && !dis[p])
			cnt++, dis[p] = true;
	}
	if(k == 64 && n == 0 && m == 0)
		cout << "18446744073709551616";
	else
		cout << (1ull << (k - cnt)) - n;
	return 0;
}

2024/7/23 18:07
加载中...