107822024-04-12 13:33:57BalimeFőnökszámcpp17Wrong answer 40/100370ms29780 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll n;    multiset<array<ll, 2>>fonok;



int main()
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    cin>>n;
    fonok.insert({0,0});
    for(ll i=0; i<n; i++)
    {
        ll a,b;
        cin>>a>>b;
        auto it=fonok.lower_bound({a+1, b+1});
        if(it==fonok.end())
        {
            it = fonok.insert({a,b});
            it--;
        }
        else
        {
            if((*it)[1]>b)
            {
                cout<<fonok.size()-1<<endl;
                continue;
            }
            else
            {
                it = fonok.insert({a,b});
                it--;
            }
        }
        //cout<<(*it)[0]<<" rr "<<(*it)[1]<<endl;
        while(it!=fonok.begin())
        {
            if((*it)[0]>=a || (*it)[1]>=b)break;
            it=fonok.erase(it); it--;
        }
        auto help=fonok.begin();
        //while(help!=fonok.end()){cout<<(*help)[0]<<" "<<(*help)[1]<<endl;help++;}
        cout<<fonok.size()-1<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1892 KiB
2Wrong answer109ms2124 KiB
subtask25/5
3Accepted3ms2296 KiB
4Accepted3ms2508 KiB
5Accepted4ms2724 KiB
6Accepted24ms2804 KiB
subtask30/10
7Accepted2ms2804 KiB
8Accepted3ms2816 KiB
9Accepted3ms3052 KiB
10Accepted3ms3036 KiB
11Wrong answer4ms3028 KiB
12Accepted4ms3124 KiB
13Accepted6ms3124 KiB
14Accepted14ms3152 KiB
subtask410/10
15Accepted3ms3368 KiB
16Accepted3ms3336 KiB
17Accepted4ms3340 KiB
18Accepted7ms3564 KiB
19Accepted14ms3664 KiB
20Accepted45ms3880 KiB
21Accepted25ms3776 KiB
22Accepted164ms16304 KiB
subtask525/25
23Accepted4ms4008 KiB
24Accepted4ms4088 KiB
25Accepted6ms4196 KiB
26Accepted8ms3992 KiB
27Accepted56ms3992 KiB
28Accepted86ms3992 KiB
29Accepted140ms3988 KiB
30Accepted116ms4016 KiB
subtask60/50
31Accepted3ms4356 KiB
32Wrong answer216ms4228 KiB
33Accepted3ms2296 KiB
34Accepted3ms2508 KiB
35Accepted4ms2724 KiB
36Accepted24ms2804 KiB
37Accepted2ms2804 KiB
38Accepted3ms2816 KiB
39Accepted3ms3052 KiB
40Accepted3ms3036 KiB
41Wrong answer4ms3028 KiB
42Accepted4ms3124 KiB
43Accepted6ms3124 KiB
44Accepted14ms3152 KiB
45Accepted3ms3368 KiB
46Accepted3ms3336 KiB
47Accepted4ms3340 KiB
48Accepted7ms3564 KiB
49Accepted14ms3664 KiB
50Accepted45ms3880 KiB
51Accepted25ms3776 KiB
52Accepted164ms16304 KiB
53Accepted4ms4008 KiB
54Accepted4ms4088 KiB
55Accepted6ms4196 KiB
56Accepted8ms3992 KiB
57Accepted56ms3992 KiB
58Accepted86ms3992 KiB
59Accepted140ms3988 KiB
60Accepted116ms4016 KiB
61Wrong answer8ms4360 KiB
62Wrong answer14ms4672 KiB
63Accepted13ms4484 KiB
64Accepted108ms10712 KiB
65Wrong answer8ms4680 KiB
66Wrong answer8ms4860 KiB
67Wrong answer8ms4712 KiB
68Wrong answer8ms4712 KiB
69Wrong answer112ms4732 KiB
70Accepted370ms29780 KiB