照着题解改了一版,仍然不行
样例:
3 3 5 4
1 4 6
0 3
2 4
2 5
输出:
5
正确输出:
13
#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;
}
怀疑是第三个for循环的问题(