正文
增加 6 行删除 6 行
16 行未改动171819202122232425262728293031323334353616 行未改动5354555657585960617 行未改动697071727374757677787980813 行未改动16 行未改动#include <bits/stdc++.h>using namespace std;#define gc()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)char buf[1<<21],*p1=buf,*p2=buf;#define int long long#define rint register inttemplate <typename T>inline void read(T& r){r=0;bool w=0; char ch=gc();while(ch<'0'||ch>'9') w=ch=='-'?1:0,ch=gc();while(ch>='0'&&ch<='9') r=(r<<1)+(r<<3)+(ch^48), ch=gc();r=w?-r:r;}int f[61],g[61];inline int find(int x){while(f[x]!=x){f[x]=f[f[x]],x=f[x];16 行未改动for(rint i=0;i<=60;++i) f[i]=i;for(rint i=1;i<=n;++i){read(a[i]);if(!a[i]){++ans;//为0的先加continue;}7 行未改动if(g[j]&(1ll<<i))//如果组j和i最高位有一位相同{if(last!=-1) merge(last,j);last=j;}}}for(rint i=0;i<=60;++i){if(g[i]&&f[i]==i) ++ans;}printf("%lld",ans);return 0;3 行未改动16 行未改动171819202122232425262728293031323334353616 行未改动5354555657585960617 行未改动697071727374757677787980813 行未改动16 行未改动#include <bits/stdc++.h>using namespace std;#define gc()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)char buf[1<<21],*p1=buf,*p2=buf;#define int long long#define rint register inttemplate <typename T>inline void read(T& r){r=0;bool w=0; char ch=gc();while(ch<'0'||ch>'9') w=ch=='-'?1:0,ch=gc();while(ch>='0'&&ch<='9') r=(r<<1)+(r<<3)+(ch^48), ch=gc();r=w?-r:r;}int f[61],g[61];inline int find(int x){while(f[x]!=x){f[x]=f[f[x]],x=f[x];16 行未改动for(rint i=0;i<=60;++i) f[i]=i;for(rint i=1;i<=n;++i){read(a[i]);if(!a[i]){++ans;//为0的先加continue;}7 行未改动if(g[j]&(1ll<<i))//如果组j和i最高位有一位相同{if(last!=-1) merge(last,j);last=j;}}}for(rint i=0;i<=60;++i){if(g[i]&&f[i]==i) ++ans;}printf("%lld",ans);return 0;3 行未改动