#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
{
cout<<fonok.size()-1<<endl;
continue;
}
//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 | 1764 KiB | ||||
2 | Wrong answer | 119ms | 1996 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 3ms | 2220 KiB | ||||
4 | Accepted | 3ms | 2428 KiB | ||||
5 | Accepted | 4ms | 2640 KiB | ||||
6 | Accepted | 21ms | 2664 KiB | ||||
subtask3 | 0/10 | ||||||
7 | Accepted | 3ms | 2776 KiB | ||||
8 | Wrong answer | 3ms | 2872 KiB | ||||
9 | Accepted | 3ms | 2876 KiB | ||||
10 | Wrong answer | 3ms | 3000 KiB | ||||
11 | Wrong answer | 4ms | 3212 KiB | ||||
12 | Wrong answer | 4ms | 3300 KiB | ||||
13 | Wrong answer | 6ms | 3424 KiB | ||||
14 | Wrong answer | 8ms | 3648 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 3ms | 3860 KiB | ||||
16 | Accepted | 3ms | 4068 KiB | ||||
17 | Accepted | 4ms | 4400 KiB | ||||
18 | Accepted | 4ms | 4364 KiB | ||||
19 | Accepted | 24ms | 4460 KiB | ||||
20 | Accepted | 25ms | 4460 KiB | ||||
21 | Accepted | 48ms | 4448 KiB | ||||
22 | Accepted | 250ms | 16848 KiB | ||||
subtask5 | 0/25 | ||||||
23 | Wrong answer | 3ms | 4436 KiB | ||||
24 | Wrong answer | 4ms | 4440 KiB | ||||
25 | Wrong answer | 6ms | 4352 KiB | ||||
26 | Wrong answer | 8ms | 4580 KiB | ||||
27 | Wrong answer | 59ms | 4564 KiB | ||||
28 | Wrong answer | 93ms | 4568 KiB | ||||
29 | Wrong answer | 115ms | 4712 KiB | ||||
30 | Wrong answer | 225ms | 4812 KiB | ||||
subtask6 | 0/50 | ||||||
31 | Accepted | 2ms | 4772 KiB | ||||
32 | Wrong answer | 116ms | 4776 KiB | ||||
33 | Accepted | 3ms | 2220 KiB | ||||
34 | Accepted | 3ms | 2428 KiB | ||||
35 | Accepted | 4ms | 2640 KiB | ||||
36 | Accepted | 21ms | 2664 KiB | ||||
37 | Accepted | 3ms | 2776 KiB | ||||
38 | Wrong answer | 3ms | 2872 KiB | ||||
39 | Accepted | 3ms | 2876 KiB | ||||
40 | Wrong answer | 3ms | 3000 KiB | ||||
41 | Wrong answer | 4ms | 3212 KiB | ||||
42 | Wrong answer | 4ms | 3300 KiB | ||||
43 | Wrong answer | 6ms | 3424 KiB | ||||
44 | Wrong answer | 8ms | 3648 KiB | ||||
45 | Accepted | 3ms | 3860 KiB | ||||
46 | Accepted | 3ms | 4068 KiB | ||||
47 | Accepted | 4ms | 4400 KiB | ||||
48 | Accepted | 4ms | 4364 KiB | ||||
49 | Accepted | 24ms | 4460 KiB | ||||
50 | Accepted | 25ms | 4460 KiB | ||||
51 | Accepted | 48ms | 4448 KiB | ||||
52 | Accepted | 250ms | 16848 KiB | ||||
53 | Wrong answer | 3ms | 4436 KiB | ||||
54 | Wrong answer | 4ms | 4440 KiB | ||||
55 | Wrong answer | 6ms | 4352 KiB | ||||
56 | Wrong answer | 8ms | 4580 KiB | ||||
57 | Wrong answer | 59ms | 4564 KiB | ||||
58 | Wrong answer | 93ms | 4568 KiB | ||||
59 | Wrong answer | 115ms | 4712 KiB | ||||
60 | Wrong answer | 225ms | 4812 KiB | ||||
61 | Wrong answer | 8ms | 4776 KiB | ||||
62 | Wrong answer | 14ms | 4876 KiB | ||||
63 | Wrong answer | 8ms | 4776 KiB | ||||
64 | Accepted | 81ms | 10972 KiB | ||||
65 | Wrong answer | 13ms | 4776 KiB | ||||
66 | Wrong answer | 8ms | 4780 KiB | ||||
67 | Wrong answer | 8ms | 5060 KiB | ||||
68 | Wrong answer | 16ms | 5036 KiB | ||||
69 | Wrong answer | 259ms | 5044 KiB | ||||
70 | Accepted | 398ms | 30064 KiB |