Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <map>
- #include <vector>
- #include <algorithm>
- #include <unordered_set>
- #include <set>
- using namespace std;
- int main() {
- ///список ребер в список смежности
- int n, m;
- cin >> n >> m;
- vector<vector<int>> g(n); //список смежности
- for (int i = 0; i < m; i++) {
- int x, y;
- cin >> x >> y;
- x--, y--;
- g[x].push_back(y);
- g[y].push_back(x);
- }
- for (auto e : g[h]) {
- ///e -- сосед h
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment