Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int ne;
- cin>>ne;
- int arr[8+1];
- int adj[8+1][8+1];
- for(int r=0; r<=8; r++)
- {
- for(int c=0; c<=8; c++)
- {
- adj[r][c] = 0;
- }
- }
- for(int i=0; i<=8; i++)
- {
- arr[i]=0;
- }
- for(int i=1; i<=ne; i++)
- {
- int u,v;
- cin>>u>>v;
- adj[u][v]=1;
- adj[v][u]=1;
- arr[u]=1;
- arr[v]=1;
- }
- for(int r=0; r<=8; r++)
- {
- for(int c=0; c<=8; c++)
- {
- if(arr[r]!=0 && arr[c]!=0)
- cout<<adj[r][c] <<" ";
- }
- arr[r]!=0;
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement