#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;
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1888 KiB | ||||
2 | Wrong answer | 232ms | 2096 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 3ms | 2296 KiB | ||||
4 | Accepted | 3ms | 2380 KiB | ||||
5 | Accepted | 4ms | 2508 KiB | ||||
6 | Accepted | 25ms | 2740 KiB | ||||
subtask3 | 0/10 | ||||||
7 | Accepted | 3ms | 2848 KiB | ||||
8 | Accepted | 3ms | 3052 KiB | ||||
9 | Accepted | 3ms | 3144 KiB | ||||
10 | Wrong answer | 3ms | 3116 KiB | ||||
11 | Wrong answer | 4ms | 3248 KiB | ||||
12 | Accepted | 4ms | 3344 KiB | ||||
13 | Wrong answer | 6ms | 3568 KiB | ||||
14 | Accepted | 8ms | 3668 KiB | ||||
subtask4 | 0/10 | ||||||
15 | Accepted | 3ms | 3680 KiB | ||||
16 | Wrong answer | 3ms | 3780 KiB | ||||
17 | Wrong answer | 4ms | 3916 KiB | ||||
18 | Wrong answer | 4ms | 4120 KiB | ||||
19 | Wrong answer | 28ms | 4184 KiB | ||||
20 | Wrong answer | 26ms | 4276 KiB | ||||
21 | Accepted | 27ms | 4272 KiB | ||||
22 | Accepted | 165ms | 16700 KiB | ||||
subtask5 | 25/25 | ||||||
23 | Accepted | 3ms | 4176 KiB | ||||
24 | Accepted | 4ms | 4180 KiB | ||||
25 | Accepted | 9ms | 4304 KiB | ||||
26 | Accepted | 14ms | 4396 KiB | ||||
27 | Accepted | 123ms | 4488 KiB | ||||
28 | Accepted | 188ms | 4388 KiB | ||||
29 | Accepted | 119ms | 4520 KiB | ||||
30 | Accepted | 123ms | 4608 KiB | ||||
subtask6 | 0/50 | ||||||
31 | Wrong answer | 3ms | 4692 KiB | ||||
32 | Wrong answer | 128ms | 4608 KiB | ||||
33 | Accepted | 3ms | 2296 KiB | ||||
34 | Accepted | 3ms | 2380 KiB | ||||
35 | Accepted | 4ms | 2508 KiB | ||||
36 | Accepted | 25ms | 2740 KiB | ||||
37 | Accepted | 3ms | 2848 KiB | ||||
38 | Accepted | 3ms | 3052 KiB | ||||
39 | Accepted | 3ms | 3144 KiB | ||||
40 | Wrong answer | 3ms | 3116 KiB | ||||
41 | Wrong answer | 4ms | 3248 KiB | ||||
42 | Accepted | 4ms | 3344 KiB | ||||
43 | Wrong answer | 6ms | 3568 KiB | ||||
44 | Accepted | 8ms | 3668 KiB | ||||
45 | Accepted | 3ms | 3680 KiB | ||||
46 | Wrong answer | 3ms | 3780 KiB | ||||
47 | Wrong answer | 4ms | 3916 KiB | ||||
48 | Wrong answer | 4ms | 4120 KiB | ||||
49 | Wrong answer | 28ms | 4184 KiB | ||||
50 | Wrong answer | 26ms | 4276 KiB | ||||
51 | Accepted | 27ms | 4272 KiB | ||||
52 | Accepted | 165ms | 16700 KiB | ||||
53 | Accepted | 3ms | 4176 KiB | ||||
54 | Accepted | 4ms | 4180 KiB | ||||
55 | Accepted | 9ms | 4304 KiB | ||||
56 | Accepted | 14ms | 4396 KiB | ||||
57 | Accepted | 123ms | 4488 KiB | ||||
58 | Accepted | 188ms | 4388 KiB | ||||
59 | Accepted | 119ms | 4520 KiB | ||||
60 | Accepted | 123ms | 4608 KiB | ||||
61 | Wrong answer | 8ms | 4624 KiB | ||||
62 | Wrong answer | 9ms | 4952 KiB | ||||
63 | Wrong answer | 16ms | 4820 KiB | ||||
64 | Accepted | 82ms | 11140 KiB | ||||
65 | Wrong answer | 8ms | 4824 KiB | ||||
66 | Wrong answer | 14ms | 4924 KiB | ||||
67 | Wrong answer | 14ms | 5180 KiB | ||||
68 | Wrong answer | 14ms | 5144 KiB | ||||
69 | Wrong answer | 167ms | 15044 KiB | ||||
70 | Accepted | 368ms | 30072 KiB |