hiho week 50 register

Ended

Participants:436

Verdict:Accepted
Score:100 / 100
Submitted:2015-06-13 21:46:22

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
#include <cstdio>
#include <vector>
using namespace std;
typedef vector<int> VI;
const int mxn = 1001;
int n, m;
int deg[mxn], p[mxn][mxn];
VI ans;
void dfs(int u){
    for(int i = 1; i <= n; ++i){
        if(p[u][i] == 0) continue;
        --p[u][i];
        --p[i][u];
        dfs(i);
    }
    ans.push_back(u);
}
int main(){
    scanf("%d %d", &n, &m);
    while(m--){
        int u, v;
        scanf("%d %d", &u, &v);
        ++p[u][v];
        ++p[v][u];
    }
    dfs(1);
    for(int i = 0; i < ans.size(); ++i)
        printf("%d ", ans[i]);
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX