fork download
  1. #include <iostream>
  2. #include <list>
  3. #include <vector>
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8. int n = 2;
  9. int v1, v2, v3;
  10. vector<list<int>> lista(n);
  11. for(int i =0 ;i < lista.size(); i++){
  12. cin>>v1 >>v2 >>v3;
  13. lista[v1].push_back(v3);
  14. }
  15. int index = 0;
  16. for (auto podlista: lista){
  17. cout<<++index<<": ";
  18. for(auto element: podlista)
  19. cout<<element;
  20. cout<<endl;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3276KB
stdin
0 1 1
1 1 2
2 1 1
stdout
1: 1
2: 2