fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <utility>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. int main() {
  8. std::vector<std::vector<std::vector<std::pair<float, int>>>> depth
  9. { {
  10. { make_pair( 4.65514, 1), make_pair(3.10343, 2) },
  11. { make_pair( 4.67043, 1), make_pair(3.11362, 2) },
  12. { make_pair( 4.68594, 1), make_pair(3.12396, 2) }
  13. } };
  14. for(auto &vec1 : depth) {
  15. for(auto &vec2 : vec1) {
  16. std::sort(vec2.begin(), vec2.end());
  17. }
  18. }
  19.  
  20. for (std::vector<std::vector<std::pair<float,int>>> vec1 : depth) {
  21. for (std::vector<std::pair<float, int>> vec2 : vec1) {
  22. if(!vec2.empty() && (vec2.size() > 1)) {
  23. for (std::pair<float, int> pr : vec2) {
  24. std::cout << pr.first << " " << pr.second << " ";
  25. }
  26. std::cout << std::endl;
  27. }
  28. }
  29. } // your code goes here
  30. return 0;
  31. }
Success #stdin #stdout 0s 16056KB
stdin
Standard input is empty
stdout
3.10343 2   4.65514 1   
3.11362 2   4.67043 1   
3.12396 2   4.68594 1