Submission #1046886

# Submission time Handle Problem Language Result Execution time Memory
1046886 2024-08-07T05:49:05 Z 12345678 Weighting stones (IZhO11_stones) C++17
0 / 100
1000 ms 2936 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=1e5+5;

int n, x, t;
set<int> a, b;

bool check(set<int> &x, set<int> &y)
{
    if (y.empty()) return 1;
    auto itrx=prev(x.end()), itry=prev(y.end());
    while (itry!=y.begin()) 
    {
        if (*itrx<*itry) return 0;
        itrx--, itry--;
    }
    if (*itrx<*itry) return 0;
    return 1;
}

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>x>>t;
        if (t==1) a.insert(x);
        else b.insert(x);
        if (a.size()>=b.size()&&check(a, b)) cout<<">\n";
        else if (b.size()>=a.size()&&check(b, a)) cout<<"<\n";
        else cout<<"?\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 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 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 9 ms 840 KB Output is correct
11 Execution timed out 1097 ms 2936 KB Time limit exceeded
12 Halted 0 ms 0 KB -