Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define ll long long
  4. #define pii pair<int, int>
  5. #define pll pair<ll, ll>
  6. #define pic pair<int, char>
  7. #define pis pair<int, string>
  8. #define pcc pair<char, char>
  9. #define pci pair<char, int>
  10. #define psi pair<string, int>
  11. #define pdd pair<double, double>
  12. #define pli pair<ll, int>
  13. #define mp make_pair
  14. #define rangeAll(a) a.begin(), a.end()
  15. #define RETWR cout << "NO"; return 0;
  16.  
  17. const ll MOD = 1000000007;
  18. const int INF = 1 << 30;
  19.  
  20. using namespace std;
  21.  
  22. int main() {
  23.     ios::sync_with_stdio(0);
  24.     cin.tie(0);
  25.     cout.tie(0);
  26.     #ifndef ONLINE_JUDGE
  27.     freopen("input.txt", "r", stdin);
  28.     #endif
  29.     multiset<int> ms;
  30.     for (int i = 0; i < 10; ++i) {
  31.         ms.insert(rand());
  32.     }
  33.     int z = 0;
  34.     for (auto it = ms.begin(); it != ms.end(); ) {
  35.         if (z & 1) {
  36.             auto del = it;
  37.             it++;
  38.             ms.erase(del);
  39.         }
  40.         else {
  41.             cout << *it << ' ';
  42.             it++;
  43.         }
  44.         z++;
  45.     }
  46.     cout << endl;
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement