int e,v; cin>>v>>e; int** arr = new int*[v]; for(int i = 0; i<v; i++){ arr[i] = new int [v]; for(int j = 0; j<v; j++){ arr[i][j] = 0; } } int x, y; for(int i = 0; i<e; i++){ cin>>x>>y; arr[x][y] = 1; arr[y][x] = 1; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter