hiho week 49 register

Ended

Participants:509

Verdict:Accepted
Score:100 / 100
Submitted:2015-06-08 22:10:52

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
typedef long long LL;
int c=0,n,m,deg[10005];
bool v[10005];
vector<int> G[10005];
void dfs(int x)
{
    c++;
    v[x]=1;
    for(int i=0;i<G[x].size();i++)
        if(!v[G[x][i]]) dfs(G[x][i]);
}
int main()
{
    int a,b;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        scanf("%d%d",&a,&b);
        G[a].push_back(b);
        G[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    dfs(1);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX