Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <fstream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ifstream in;
  8. ofstream out;
  9. in.open("input.txt");
  10. out.open("output.txt");
  11.  
  12. int tops, edges;
  13. in >> tops >> edges;
  14.  
  15. vector<vector<int>> graph;
  16. graph.resize(tops);
  17.  
  18. // �����������������
  19. int top1, top2;
  20. for (int i = 0; i < edges; i++) {
  21. in >> top1 >> top2;
  22. graph[top1 - 1].push_back(top2);
  23. graph[top2 - 1].push_back(top1);
  24. }
  25.  
  26. for (int i = 0; i < tops; i++) {
  27. out << graph[i].size() << " ";
  28. }
  29.  
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement