| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 469909 | Karabasan | Deda (COCI17_deda) | C++17 | 6 ms | 692 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define lll long long
using namespace std;
lll n,q;
char a;
lll b,c;
multiset<pair<lll,lll> > s;
map<pair<lll,lll>,lll > mp;
lll par(pair<lll,lll> k,pair<lll,lll> z)
{
    return ((k.first<z.first)||(k.second<z.second));
}
lll bul(pair<lll,lll> &p)
{
    auto up=lower_bound(s.begin(),s.end(),p,par);
    if(up==s.end())
    {
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<(*up).first<<endl;
}
int main()
{
    scanf("%lld%lld",&n,&q);
    while(q--)
    {
        cin>>a>>b>>c;
        if(mp[{c,b}]==1)
            {
                printf("%lld\n",c);
                continue;
            }
        mp[{c,b}]=1;
        if(a=='M')
        {
            s.insert({c,-b});
        }
        else
        {
            pair<lll,lll> pa={c,-b};
            bul(pa);
        }
    }
    return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
