56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <bitset>
|
|
#include <type_traits>
|
|
|
|
using ull = unsigned long long;
|
|
using std::cin,std::cout,std::iostream,std::bitset;
|
|
ull n,m,c,k,num,input,p,q,ans {1};
|
|
bitset<64+5> bt;
|
|
|
|
template<class T>
|
|
class ReadNumber{
|
|
char c;
|
|
T w,n;
|
|
public:
|
|
ReadNumber& operator>>(T &num)noexcept{
|
|
c=(char)0,w=1,n=0;
|
|
while(!isdigit(c)){
|
|
if constexpr(!std::is_same_v<ull, T>){
|
|
if(c=='-')w=-1;
|
|
}
|
|
c = getchar();
|
|
}
|
|
while(isdigit(c)){
|
|
n = n*10 + (c-'0');
|
|
c = getchar();
|
|
}
|
|
num = w*n;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
ReadNumber<ull> readull;
|
|
#define cin readull
|
|
|
|
int main(){
|
|
cin>>n>>m>>c>>k;
|
|
|
|
if(n==0 && m==0 && k==64){
|
|
cout<<"18446744073709551616\n";
|
|
return 0;
|
|
}
|
|
|
|
for(ull i=0;i<n;i++){
|
|
cin>>input;
|
|
num |= input;
|
|
}
|
|
for(ull i=0;i<m;i++){
|
|
cin>>p>>q;
|
|
if(!((num>>p)&1) && !bt[p]){
|
|
k--;
|
|
bt[p]=true;
|
|
}
|
|
}
|
|
for(int i=0;i<k;i++)ans*=2;
|
|
cout<<ans-n<<'\n';
|
|
} |