107792024-04-12 13:11:18BalimeFőnökszámcpp17Wrong answer 30/100368ms30072 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.insert({a,b});
        it++;
        if(it==fonok.end())
        {
            it--;
            it--;
        }
        else
        {
            if((*it)[1]>b && (*it)[0]>a)
            {
                it--;
                fonok.erase(it);
                cout<<fonok.size()-1<<endl;
                continue;
            }
            else
            {
                it--;
                it--;
            }
        }
        while(it!=fonok.begin())
        {
            if((*it)[0]>=a || (*it)[1]>=b)break;
            it=fonok.erase(it); it--;
        }
        
        cout<<fonok.size()-1<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1888 KiB
2Wrong answer232ms2096 KiB
subtask25/5
3Accepted3ms2296 KiB
4Accepted3ms2380 KiB
5Accepted4ms2508 KiB
6Accepted25ms2740 KiB
subtask30/10
7Accepted3ms2848 KiB
8Accepted3ms3052 KiB
9Accepted3ms3144 KiB
10Wrong answer3ms3116 KiB
11Wrong answer4ms3248 KiB
12Accepted4ms3344 KiB
13Wrong answer6ms3568 KiB
14Accepted8ms3668 KiB
subtask40/10
15Accepted3ms3680 KiB
16Wrong answer3ms3780 KiB
17Wrong answer4ms3916 KiB
18Wrong answer4ms4120 KiB
19Wrong answer28ms4184 KiB
20Wrong answer26ms4276 KiB
21Accepted27ms4272 KiB
22Accepted165ms16700 KiB
subtask525/25
23Accepted3ms4176 KiB
24Accepted4ms4180 KiB
25Accepted9ms4304 KiB
26Accepted14ms4396 KiB
27Accepted123ms4488 KiB
28Accepted188ms4388 KiB
29Accepted119ms4520 KiB
30Accepted123ms4608 KiB
subtask60/50
31Wrong answer3ms4692 KiB
32Wrong answer128ms4608 KiB
33Accepted3ms2296 KiB
34Accepted3ms2380 KiB
35Accepted4ms2508 KiB
36Accepted25ms2740 KiB
37Accepted3ms2848 KiB
38Accepted3ms3052 KiB
39Accepted3ms3144 KiB
40Wrong answer3ms3116 KiB
41Wrong answer4ms3248 KiB
42Accepted4ms3344 KiB
43Wrong answer6ms3568 KiB
44Accepted8ms3668 KiB
45Accepted3ms3680 KiB
46Wrong answer3ms3780 KiB
47Wrong answer4ms3916 KiB
48Wrong answer4ms4120 KiB
49Wrong answer28ms4184 KiB
50Wrong answer26ms4276 KiB
51Accepted27ms4272 KiB
52Accepted165ms16700 KiB
53Accepted3ms4176 KiB
54Accepted4ms4180 KiB
55Accepted9ms4304 KiB
56Accepted14ms4396 KiB
57Accepted123ms4488 KiB
58Accepted188ms4388 KiB
59Accepted119ms4520 KiB
60Accepted123ms4608 KiB
61Wrong answer8ms4624 KiB
62Wrong answer9ms4952 KiB
63Wrong answer16ms4820 KiB
64Accepted82ms11140 KiB
65Wrong answer8ms4824 KiB
66Wrong answer14ms4924 KiB
67Wrong answer14ms5180 KiB
68Wrong answer14ms5144 KiB
69Wrong answer167ms15044 KiB
70Accepted368ms30072 KiB