Advertisement
Josif_tepe

Untitled

Apr 21st, 2021
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include<queue>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int k;
  9.     cin >> k;
  10.     vector<int> graph[k + 1];
  11.     for(int i = 0; i < k - 1; i++) {
  12.         int a, b;
  13.         cin >> a >> b;
  14.         graph[a].push_back(b);
  15.         graph[b].push_back(a);
  16.     }
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement