P1395 会议
#include<bits/stdc++.h>
using namespace std;
const int N=5*(1e4+1);
int n;
int a,b;
int arr[N][N];//链接图表
int vis[N] ;//判断是否被访问
int fu[N];//记录size
inline int DFS(int cnt)
{
for(int i=1;i<=n;i++)
{
if(vis[cnt]==1)continue;
if(arr[i][cnt])
{
fu[cnt]=DFS(i);
return fu[cnt];
}
}
fu[cnt]=1;
return fu[cnt];
}
int main()
{
/* ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);*/
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a>>b;
arr[a][b]=1;
arr[b][a]=1;
}
DFS(1);
for(int i=1;i<=n;i++)cout<<fu[i];
return 0;
}
//本地CE提示(部分) 207 C:\Users\Lenovo\AppData\Local\Temp\cc5bkrjh.s Error: value of 00000002542d77a6 too large for field of 4 bytes at 00000000000000e6
249 C:\Users\Lenovo\AppData\Local\Temp\cc5bkrjh.s Error: value of 0000000254308534 too large for field of 4 bytes at 0000000000000120