fork download
  1. #include <iostream>
  2. #include <map> //for map<>
  3. using namespace std;
  4. int main()
  5. {
  6. int t,k;
  7. map<int,int> mp;
  8.  
  9. cin>>t;
  10. for(int i=0;i<t;i++)
  11. {
  12. cin>>k;
  13. mp[k]++;
  14. }
  15.  
  16. //Outputs the duplicate elements in sorted order
  17. for(auto i:mp) //c++!1 extension
  18. {
  19. if(i.second>=2)
  20. cout<<i.first<<" ";
  21. }
  22. cout<<"\n";
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.7s 15232KB
stdin
Standard input is empty
stdout
11013