帮我调了这道题
我知道我很蒟蒻,但是我不知道我的思路是哪里出了问题qwq
事已至此,你已经点进来了,帮我调一下吧。
全部WA 0分 damn:
#include <bits/stdc++.h>
using namespace std;
const int N=1010;
int n;
int m;
int a[N][N];
int s[N][N];
int ans[N];
int x,y;
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>x>>y;
a[x][y]=1;
a[y][x]=1;
s[x][y]=1;
s[y][x]=1;
ans[x]++;
ans[y]++;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
for(int i=1;i<=n;i++)
{
cout<<ans[i]<<" ";
sort(s[i]+1,s[i]+ans[i]+1);
for(int j=1;j<=ans[i];j++)
{
if(s[i][j]==1)cout<<j<<" ";
}
cout<<endl;
}
return 0;
}
qwjb,wgzs