39 lines
436 B
C++
39 lines
436 B
C++
|
#include <bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
vector<int> graph[101];
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int n,m,x,y;
|
||
|
cin>>n>>m;
|
||
|
for(int i=1;i<=m;i++)
|
||
|
{
|
||
|
cin>>x>>y;
|
||
|
//todo
|
||
|
graph[x].push_back(y);
|
||
|
graph[y].push_back(x);
|
||
|
}
|
||
|
for(int i=1;i<=n;i++)
|
||
|
{
|
||
|
//todo
|
||
|
// for(int j=0;j<graph[i].size();j++)
|
||
|
// {
|
||
|
// cout<<graph[i][j]<<" ";
|
||
|
// }
|
||
|
for(int j:graph[i])
|
||
|
{
|
||
|
cout<<j<<" ";
|
||
|
}
|
||
|
cout<<endl;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
/*
|
||
|
5 5
|
||
|
1 2
|
||
|
2 3
|
||
|
3 4
|
||
|
4 5
|
||
|
5 1
|
||
|
*/
|