fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int a[100][100];
  4. int main () {
  5. //freopen("count.in","r",stdin);
  6. //freopen("count.out","w",stdout);
  7. int n , m ;
  8. cin >> n >> m ;
  9. int x , y;
  10. for (int i =1 ; i <=m ; i++ ) {
  11. cin >> x >> y ;
  12. a[x][y]=1;
  13. a[y][x]=1;
  14. }
  15. for (int i = 1 ; i <= n ;i++){
  16. for (int j=1; j <= n ; j++ ) {
  17. cout << a[i][j] << " ";
  18. }
  19. cout <<endl;
  20. }
  21. }
  22.  
Success #stdin #stdout 0s 4520KB
stdin
3 3
1 2
2 3
1 3
stdout
0 1 1 
1 0 1 
1 1 0