Submission #860182

# Submission time Handle Problem Language Result Execution time Memory
860182 2023-10-12T04:30:45 Z aykhn Weighting stones (IZhO11_stones) C++14
0 / 100
1 ms 348 KB
#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 time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -