Quipex

black_friday

Apr 5th, 2017
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int n;
  7. long long c;
  8. queue<long long> mq;
  9. int main()
  10. {
  11.     cin>>n;
  12.     while (n--)
  13.     {
  14.         scanf("%lld", &c);
  15.         if (mq.empty() || mq.front() != c)
  16.         {
  17.             printf("%lld\n", c);
  18.             mq.push((c << 2) / 3);
  19.         }
  20.         else if (!mq.empty())
  21.             mq.pop();
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment