fork download
  1. #include <iostream>
  2. #include <type_traits>
  3. #include <vector>
  4. #include <memory>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. vector<vector<int>> mySol = {{3,1},{1,2},{4,5},{1,3},{1,2}};
  10. auto minIt = std::min(mySol.begin(), mySol.end());
  11. cout << (*minIt)[0] << endl;
  12.  
  13. int nShortest = 0;
  14. for (auto it = mySol.begin(); it != mySol.end(); ++it) {
  15. if ((*it)[0] == (*minIt)[0]) ++nShortest;
  16. }
  17. cout << nShortest << " ";
  18.  
  19. for (auto it = mySol.begin(); it != mySol.end(); ++it) {
  20. if ((*it)[0] == (*minIt)[0]) {
  21. cout << (*it)[1] << " ";
  22. }
  23. }
  24. }
  25.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
3
1 1