fork download
  1. /* >>455 */
  2. #include <iostream>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <chrono>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. vector< vector<int> > arr {
  12. {1,5,3,4},
  13. {0,4,1,0},
  14. {7,2,3,1}
  15. };
  16. const auto start = chrono::system_clock::now();
  17.  
  18. for (auto& row : arr)
  19. sort( row.begin(), row.end() );
  20. sort( arr.begin(), arr.end() );
  21.  
  22. const chrono::duration<double> elapsed = chrono::system_clock::now() - start;
  23.  
  24. /* results. */
  25. for (auto& row : arr)
  26. {
  27. for (auto& col : row)
  28. cout << col << ", ";
  29. cout << endl;
  30. }
  31. cout << elapsed.count() << " sec." << endl;
  32. return 0;
  33. }
Success #stdin #stdout 0s 3480KB
stdin
Standard input is empty
stdout
0, 0, 1, 4, 
1, 2, 3, 7, 
1, 3, 4, 5, 
1.942e-06 sec.