#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.upper_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 | 1888 KiB | ||||
2 | Wrong answer | 116ms | 2088 KiB | ||||
subtask2 | 0/5 | ||||||
3 | Wrong answer | 3ms | 2196 KiB | ||||
4 | Wrong answer | 3ms | 2544 KiB | ||||
5 | Wrong answer | 4ms | 2496 KiB | ||||
6 | Accepted | 14ms | 2684 KiB | ||||
subtask3 | 0/10 | ||||||
7 | Accepted | 3ms | 2916 KiB | ||||
8 | Wrong answer | 3ms | 2760 KiB | ||||
9 | Accepted | 3ms | 2920 KiB | ||||
10 | Wrong answer | 3ms | 2892 KiB | ||||
11 | Wrong answer | 3ms | 2972 KiB | ||||
12 | Wrong answer | 4ms | 3108 KiB | ||||
13 | Wrong answer | 6ms | 3396 KiB | ||||
14 | Wrong answer | 8ms | 3332 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 3ms | 3428 KiB | ||||
16 | Accepted | 3ms | 3492 KiB | ||||
17 | Accepted | 4ms | 3344 KiB | ||||
18 | Accepted | 4ms | 3348 KiB | ||||
19 | Accepted | 28ms | 3560 KiB | ||||
20 | Accepted | 48ms | 3580 KiB | ||||
21 | Accepted | 54ms | 3784 KiB | ||||
22 | Accepted | 174ms | 16532 KiB | ||||
subtask5 | 0/25 | ||||||
23 | Wrong answer | 3ms | 4088 KiB | ||||
24 | Wrong answer | 4ms | 4208 KiB | ||||
25 | Wrong answer | 6ms | 4432 KiB | ||||
26 | Wrong answer | 8ms | 4516 KiB | ||||
27 | Wrong answer | 71ms | 4540 KiB | ||||
28 | Wrong answer | 90ms | 4768 KiB | ||||
29 | Wrong answer | 115ms | 4840 KiB | ||||
30 | Wrong answer | 116ms | 4844 KiB | ||||
subtask6 | 0/50 | ||||||
31 | Accepted | 3ms | 4984 KiB | ||||
32 | Wrong answer | 109ms | 4732 KiB | ||||
33 | Wrong answer | 3ms | 2196 KiB | ||||
34 | Wrong answer | 3ms | 2544 KiB | ||||
35 | Wrong answer | 4ms | 2496 KiB | ||||
36 | Accepted | 14ms | 2684 KiB | ||||
37 | Accepted | 3ms | 2916 KiB | ||||
38 | Wrong answer | 3ms | 2760 KiB | ||||
39 | Accepted | 3ms | 2920 KiB | ||||
40 | Wrong answer | 3ms | 2892 KiB | ||||
41 | Wrong answer | 3ms | 2972 KiB | ||||
42 | Wrong answer | 4ms | 3108 KiB | ||||
43 | Wrong answer | 6ms | 3396 KiB | ||||
44 | Wrong answer | 8ms | 3332 KiB | ||||
45 | Accepted | 3ms | 3428 KiB | ||||
46 | Accepted | 3ms | 3492 KiB | ||||
47 | Accepted | 4ms | 3344 KiB | ||||
48 | Accepted | 4ms | 3348 KiB | ||||
49 | Accepted | 28ms | 3560 KiB | ||||
50 | Accepted | 48ms | 3580 KiB | ||||
51 | Accepted | 54ms | 3784 KiB | ||||
52 | Accepted | 174ms | 16532 KiB | ||||
53 | Wrong answer | 3ms | 4088 KiB | ||||
54 | Wrong answer | 4ms | 4208 KiB | ||||
55 | Wrong answer | 6ms | 4432 KiB | ||||
56 | Wrong answer | 8ms | 4516 KiB | ||||
57 | Wrong answer | 71ms | 4540 KiB | ||||
58 | Wrong answer | 90ms | 4768 KiB | ||||
59 | Wrong answer | 115ms | 4840 KiB | ||||
60 | Wrong answer | 116ms | 4844 KiB | ||||
61 | Wrong answer | 8ms | 4696 KiB | ||||
62 | Wrong answer | 9ms | 5136 KiB | ||||
63 | Wrong answer | 13ms | 5004 KiB | ||||
64 | Accepted | 85ms | 11100 KiB | ||||
65 | Wrong answer | 14ms | 4908 KiB | ||||
66 | Wrong answer | 14ms | 4904 KiB | ||||
67 | Wrong answer | 8ms | 5004 KiB | ||||
68 | Wrong answer | 8ms | 5132 KiB | ||||
69 | Wrong answer | 236ms | 5140 KiB | ||||
70 | Time limit exceeded | 418ms | 30324 KiB |