fork(1) download
  1. #include <map>
  2. #include <vector>
  3. #include <iostream>
  4.  
  5. int main() {
  6. std::map<int, std::vector<int>> tree{
  7. {1, {0}}, {2, {1, 0}}, {3, {2, 1, 0}}, {4, { 3, 2, 1, 0 }}, {5, { 0 }}
  8. };
  9.  
  10. for (auto const &kv : tree) {
  11. std::cout << kv.first << " =>";
  12. for (auto const &i : kv.second)
  13. std::cout << " " << i;
  14. std::cout << std::endl;
  15. }
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 4384KB
stdin
Standard input is empty
stdout
1 => 0
2 => 1 0
3 => 2 1 0
4 => 3 2 1 0
5 => 0