fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <set>
  4. #include <map>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main(int argc, const char * argv[])
  10. {
  11.  
  12. map <unsigned,multiset<int>,greater <int>> mapT;
  13.  
  14. for(int i = 0; i < 100; ++i)
  15. {
  16. mapT[rand()%10].insert(rand()%20);
  17. }
  18.  
  19. for(auto m: mapT)
  20. {
  21. cout << m.first << ": ";
  22. for(auto n: m.second) cout << n << " "; cout << endl;
  23. }
  24. }
  25.  
Success #stdin #stdout 0s 4488KB
stdin
Standard input is empty
stdout
9: 1 2 4 7 7 8 12 13 16 17 
8: 4 4 5 8 9 11 15 15 
7: 1 2 5 8 8 9 11 12 13 15 15 16 16 
6: 1 1 3 3 5 5 6 8 9 11 12 13 18 
5: 5 7 9 10 10 13 
4: 1 4 4 7 7 8 14 15 17 18 19 19 19 
3: 0 6 6 6 10 11 11 11 15 16 17 19 
2: 0 3 5 7 9 10 10 11 16 16 18 
1: 0 0 2 8 10 15 15 17 19 
0: 6 8 9 9 19