2333

#include<bits/stdc++.h>
 using namespace std;
 
 typedef long long LL;
 const int maxn=1e5+7;
 struct Edge {
     LL v, next;                                 //v是指针
 } star[maxn<<1];
 LL head[maxn],eg;
 void Addedge(LL u, LL v) {
     ++eg; star[eg] = {v, head[u]}, head[u] = eg;// 建两条边
 }
 void dfs1(LL u) {
     for(LL i = head[u]; i; i = star[i].next) {
         cout<<i<<endl;
     }
 }
 int main()
 {
     int n,m;cin>>n>>m;
     for(int i=1;i<=m;i++){
         int num1,num2;
         cin>>num1>>num2;
         Addedge(num1,num2);
     }
     dfs1(1);
     system("pause");
     return 0;
 }
posted @ 2020-03-21 18:30  snowink  阅读(268)  评论(0)    收藏  举报