UKE求助,本地是对的
查看原帖
UKE求助,本地是对的
692274
hgckythgcfhk楼主2023/10/7 07:32
#include<bits/stdc++.h>
using namespace std;
#define void inline void
#define int register unsigned
const unsigned short p[19]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67},cnt=19;
unsigned dp[71][1<<19];vector<unsigned short>a[71];unsigned b[71];const unsigned m=1e9+7;
void init(){for(int i=2;i<71;++i)for(int j=0;j<cnt;++j)if(i%p[j]==0)a[i].emplace_back(j);}
unsigned _2[100002]={1},tot=1;
inline unsigned pw2(int d,int c){if(_2[c])return 1ll*_2[c]*d%m;
for(tot;tot<=c;++tot)_2[tot]=(_2[tot-1]<<1)%m;return 1ll*_2[c]*d%m;}
signed main(){int x;cin>>x;init();while(cin>>x)++b[x];dp[0][0]=1;
	for(int i=1;i<71;++i){int c=0;for(int j:a[i])c|=1<<j;
		if(!b[i]){for(int j=0;j<1<<19;++j)dp[i][j]+=dp[i-1][j];continue;}
		for(int j=0;j<1<<19;++j)dp[i][j]+=pw2(dp[i-1][j^c]+dp[i-1][j],b[i]-1),
	dp[i][j]%=m;}cout<<dp[70][0]-1;
}
2023/10/7 07:32
加载中...