Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- using namespace std;
- // хранение графа ч/з матрицу смежности
- int main() {
- int n,m;
- cin >> n >> m;
- vector<vector<int> > v(n, vector<int> (n));
- for (int i = 0; i < m; i++) {
- int s,f;
- cin >> s >> f;
- v[s][f] = 1;
- v[f][s] = 1;
- }
- for (int i = 0; i < n; i++){
- for (int j = 0; j < n; j++)
- cout << v[i][j] << " ";
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement