2024-10-03 15:29:49 +00:00
|
|
|
|
#include <iostream>
|
2024-10-03 16:10:57 +00:00
|
|
|
|
#include <bitset>
|
|
|
|
|
#include <type_traits>
|
2024-10-03 15:29:49 +00:00
|
|
|
|
|
2024-10-03 16:10:57 +00:00
|
|
|
|
using ull = unsigned long long;
|
2024-10-03 16:24:14 +00:00
|
|
|
|
using std::cout,std::iostream,std::bitset;
|
2024-10-03 16:10:57 +00:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-03 16:24:14 +00:00
|
|
|
|
ull n,m,c,k,num,input,p,q,ans {1};
|
|
|
|
|
bitset<64+5> bt;
|
|
|
|
|
|
2024-10-03 16:10:57 +00:00
|
|
|
|
ReadNumber<ull> readull;
|
|
|
|
|
#define cin readull
|
2024-10-02 06:29:36 +00:00
|
|
|
|
|
|
|
|
|
int main(){
|
2024-10-03 15:29:49 +00:00
|
|
|
|
cin>>n>>m>>c>>k;
|
2024-10-03 16:10:57 +00:00
|
|
|
|
|
2024-10-03 16:51:00 +00:00
|
|
|
|
if(n==0 && m==0 && k==64){ //特判
|
2024-10-03 16:10:57 +00:00
|
|
|
|
cout<<"18446744073709551616\n";
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(ull i=0;i<n;i++){
|
|
|
|
|
cin>>input;
|
2024-10-03 16:51:00 +00:00
|
|
|
|
num |= input; //所有编号占用的'1'的位置,把他并在一起
|
2024-10-03 16:10:57 +00:00
|
|
|
|
}
|
|
|
|
|
for(ull i=0;i<m;i++){
|
|
|
|
|
cin>>p>>q;
|
2024-10-03 16:51:00 +00:00
|
|
|
|
if(!((num>>p)&1) && !bt[p]){ //已有的n个编号里面没有出现过的规则,并且还未标记,bt用来去重
|
2024-10-03 16:10:57 +00:00
|
|
|
|
k--;
|
|
|
|
|
bt[p]=true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-03 16:51:00 +00:00
|
|
|
|
for(int i=0;i<k;i++)ans*=2; //此时ans=所有(未排除n个已用规则),可以用的二进制位的组合
|
|
|
|
|
cout<<ans-n<<'\n';//注意这里要去重
|
2024-10-02 06:29:36 +00:00
|
|
|
|
}
|