fork download
  1. #include <bits/stdc++.h>
  2. #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  3. #define all(x) x.begin(), x.end()
  4. #define rall(x) x.rbegin(), x.rend()
  5. #define fr first
  6. #define sc second
  7. #define el '\n'
  8. #define ll long long
  9. using namespace std;
  10. const int N = 2e5 + 5;
  11. void solve()
  12. {
  13. int n; cin >> n;
  14. vector<int> nums(n), odd_numbers;
  15. for (auto& i : nums)
  16. {
  17. cin >> i;
  18. if (i & 1)
  19. odd_numbers.push_back(i);
  20. }
  21. map<string, int> mp;
  22. for (auto& i : nums)
  23. mp[to_string(i)]++;
  24. vector<pair<string, int>> repeated;
  25. for (auto& it : mp)
  26. if (it.sc > 1)
  27. repeated.push_back(it);
  28. string largest = "";
  29. for (auto it = mp.rbegin(); it != mp.rend(); it++)
  30. {
  31. for (int i = 0; i < it->sc; i++)
  32. largest += it->fr;
  33. }
  34. cout << "odd numbers: " << el;
  35. for (auto& i : odd_numbers)
  36. cout << i << ' ';
  37. cout << el << "Repeated numbers: " << el;
  38. for (auto& i : repeated)
  39. cout << "( " << i.fr << " : " << i.sc << " ) ";
  40. cout << el << "Largest number: " << el << largest << el;
  41. }
  42.  
  43. int32_t main() {
  44. fast;
  45.  
  46. #ifndef ONLINE_JUDGE
  47. freopen("input.txt", "r", stdin);
  48. freopen("output.txt", "w", stdout);
  49. #endif
  50.  
  51. int t = 1;
  52. // cin >> t;
  53. for (int cs = 1; cs <= t; cs++) {
  54. solve();
  55. }
  56. }
  57.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
odd numbers: 

Repeated numbers: 

Largest number: