Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8.  
  9. vector<int> List[1000];
  10.  
  11.  
  12. int main() {
  13.  
  14. int V,E,a,b;
  15.  
  16. cin>>V>>E;
  17.  
  18. for(int i = 1; i<=E; i++){
  19. cin>>a>>b;
  20. List[a].push_back(b);
  21. }
  22. for(int i = 0; i<V; i++){
  23. cout << i << " ";
  24. sort(List[i].begin(), List[i].end());
  25. for(int j=0; j<List[i].size(); j++){
  26. cout << List[i][j] << " ";
  27. }
  28. cout<<endl;
  29. }
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement