Submission #860182

#TimeUsernameProblemLanguageResultExecution timeMemory
860182aykhnWeighting stones (IZhO11_stones)C++14
0 / 100
1 ms348 KiB
#include <bits/stdc++.h>
 
// author : aykhn
 
using namespace std;
typedef long long ll;
 
#define pb push_back
#define ins insert
#define mpr make_pair
#define all(v) v.begin(), v.end()
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define int ll
#define infll 0x3F3F3F3F3F3F3F3F
#define inf 0x3F3F3F3F

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin >> n;
    set<int> v[2];
    for (int i = 1; i <= n; i++)
    {
        int x, y;
        cin >> x >> y;
        v[y - 1].ins(x);
        auto it0 = v[0].rbegin();
        auto it1 = v[1].rbegin();
        int c0, c1;
        c0 = c1 = 0;
        int cnt = 0;
        if (i == 1)
        {
            cout << (v[0].size() ? '>' : '<') << '\n';
            continue;
        }
        while (it0 != v[0].rend() && it1 != v[1].rend())
        {
            if (*it0 > *it1) c0++;
            else c1++;
            it0++;
            it1++;
            cnt++;
        }
        if (cnt == c0)
        {
            if (v[0].size() >= v[1].size()) 
            {
                cout << ">\n";
            }
            else
            {
                cout << "?\n";
            }
        }
        else if (cnt == c1)
        {
            if (v[1].size() >= v[0].size())
            {
                cout << "<\n";
            }
            else
            {
                cout << "?\n";
            }
        }
        else cout << "?\n";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...