标签:char getchar include closed fine 预处理 register long gis
神仙题
放个链接先
然后存下还没打完的代码QAQ
#include<bits/stdc++.h> using namespace std; #define ll long long #define rp(i,x,y) for(register ll i=x;i<=y;++i) #define lowbit(x) x&(-x) ll n,m,zt[60],dp[68000000],sz[68000000]; inline ll read() { register char ch=getchar();register ll x=0;register bool y=1; while(ch!=‘-‘ && (ch>‘9‘ || ch<‘0‘))ch=getchar(); if(ch==‘-‘)ch=getchar(),y=0; while(ch>=‘0‘ && ch<=‘9‘)x=(x<<1)+(x<<3)+(ch^‘0‘),ch=getchar(); return y?x:-x; } int main() { n=read();m=read();rp(i,1,n)zt[i]=(1<<n)-1;rp(i,1,m){ll t1=read(),t2=read();zt[t1]^=(1<<t2);zt[t2]^=(1<<t1);} rp(i,1,25)dp[1<<i]=1,sz[1<<i]=1; rp(i,2,(1<<26)-1) { ll tmp=i; while(tmp) { ll v=lowbit(tmp);tmp-=v; ll sz1=sz[i^v]+1,nm1=dp[i^v];if(sz1>sz[i])sz[i]=sz1;if(sz1==sz[i])dp[i]+=nm1; ll sz2=sz[(i^v)&zt[v]],nm2=dp[(i^v)&zt[v]];if(sz2>sz[i])sz[i]=sz2;if(sz2==sz[i])dp[i]+=nm2; } } //预处理完毕? return 0; }
下午写QAQ
标签:char getchar include closed fine 预处理 register long gis
原文地址:https://www.cnblogs.com/lqsukida/p/10313683.html