fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <unordered_set>
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. int n = 5;
  9. vector<pair<int, unordered_set<int>>> graph(n, make_pair(0, unordered_set<int>()));
  10. graph[0].first = 1;
  11. graph[1].second.insert(5);
  12. graph[1].second.insert(6);
  13. for (auto&& p : graph) {
  14. std::cout << p.first << " " << p.second.size() << std::endl;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
1 0
0 2
0 0
0 0
0 0