Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ld long double
- #define pb push_back
- #define p_b pop_back
- #define si stack<int>
- #define sll stack<ll>
- #define sc stack<char>
- #define vi vector<int>
- #define vll vector<ll>
- #define mii map<int, int>
- #define msi map<string, int>
- #define mci map<char, int>
- #define qc queue<char>
- #define qi queue<int>
- #define qll queue<ll>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- ll n;
- qll a;
- sll b;
- cin >> n;
- for(ll i = 0; i < n; i++){
- ll x;
- cin >> x;
- a.push(x);
- b.push(x);
- }
- while(a.size() > 0 && b.size() > 0){
- if(a.front() > b.top()){
- cout << 1 << " ";
- b.pop();
- } else if(a.front() < b.top()){
- cout << 2 << " ";
- a.pop();
- } else{
- cout << 0 << " ";
- a.pop();
- b.pop();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement