#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;
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1892 KiB | ||||
2 | Wrong answer | 109ms | 2124 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 3ms | 2296 KiB | ||||
4 | Accepted | 3ms | 2508 KiB | ||||
5 | Accepted | 4ms | 2724 KiB | ||||
6 | Accepted | 24ms | 2804 KiB | ||||
subtask3 | 0/10 | ||||||
7 | Accepted | 2ms | 2804 KiB | ||||
8 | Accepted | 3ms | 2816 KiB | ||||
9 | Accepted | 3ms | 3052 KiB | ||||
10 | Accepted | 3ms | 3036 KiB | ||||
11 | Wrong answer | 4ms | 3028 KiB | ||||
12 | Accepted | 4ms | 3124 KiB | ||||
13 | Accepted | 6ms | 3124 KiB | ||||
14 | Accepted | 14ms | 3152 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 3ms | 3368 KiB | ||||
16 | Accepted | 3ms | 3336 KiB | ||||
17 | Accepted | 4ms | 3340 KiB | ||||
18 | Accepted | 7ms | 3564 KiB | ||||
19 | Accepted | 14ms | 3664 KiB | ||||
20 | Accepted | 45ms | 3880 KiB | ||||
21 | Accepted | 25ms | 3776 KiB | ||||
22 | Accepted | 164ms | 16304 KiB | ||||
subtask5 | 25/25 | ||||||
23 | Accepted | 4ms | 4008 KiB | ||||
24 | Accepted | 4ms | 4088 KiB | ||||
25 | Accepted | 6ms | 4196 KiB | ||||
26 | Accepted | 8ms | 3992 KiB | ||||
27 | Accepted | 56ms | 3992 KiB | ||||
28 | Accepted | 86ms | 3992 KiB | ||||
29 | Accepted | 140ms | 3988 KiB | ||||
30 | Accepted | 116ms | 4016 KiB | ||||
subtask6 | 0/50 | ||||||
31 | Accepted | 3ms | 4356 KiB | ||||
32 | Wrong answer | 216ms | 4228 KiB | ||||
33 | Accepted | 3ms | 2296 KiB | ||||
34 | Accepted | 3ms | 2508 KiB | ||||
35 | Accepted | 4ms | 2724 KiB | ||||
36 | Accepted | 24ms | 2804 KiB | ||||
37 | Accepted | 2ms | 2804 KiB | ||||
38 | Accepted | 3ms | 2816 KiB | ||||
39 | Accepted | 3ms | 3052 KiB | ||||
40 | Accepted | 3ms | 3036 KiB | ||||
41 | Wrong answer | 4ms | 3028 KiB | ||||
42 | Accepted | 4ms | 3124 KiB | ||||
43 | Accepted | 6ms | 3124 KiB | ||||
44 | Accepted | 14ms | 3152 KiB | ||||
45 | Accepted | 3ms | 3368 KiB | ||||
46 | Accepted | 3ms | 3336 KiB | ||||
47 | Accepted | 4ms | 3340 KiB | ||||
48 | Accepted | 7ms | 3564 KiB | ||||
49 | Accepted | 14ms | 3664 KiB | ||||
50 | Accepted | 45ms | 3880 KiB | ||||
51 | Accepted | 25ms | 3776 KiB | ||||
52 | Accepted | 164ms | 16304 KiB | ||||
53 | Accepted | 4ms | 4008 KiB | ||||
54 | Accepted | 4ms | 4088 KiB | ||||
55 | Accepted | 6ms | 4196 KiB | ||||
56 | Accepted | 8ms | 3992 KiB | ||||
57 | Accepted | 56ms | 3992 KiB | ||||
58 | Accepted | 86ms | 3992 KiB | ||||
59 | Accepted | 140ms | 3988 KiB | ||||
60 | Accepted | 116ms | 4016 KiB | ||||
61 | Wrong answer | 8ms | 4360 KiB | ||||
62 | Wrong answer | 14ms | 4672 KiB | ||||
63 | Accepted | 13ms | 4484 KiB | ||||
64 | Accepted | 108ms | 10712 KiB | ||||
65 | Wrong answer | 8ms | 4680 KiB | ||||
66 | Wrong answer | 8ms | 4860 KiB | ||||
67 | Wrong answer | 8ms | 4712 KiB | ||||
68 | Wrong answer | 8ms | 4712 KiB | ||||
69 | Wrong answer | 112ms | 4732 KiB | ||||
70 | Accepted | 370ms | 29780 KiB |