#include <bits/stdc++.h>
using namespace std;
int n;
multiset<pair<int,int>> s;
void ins(int a, int b){
auto it = s.lower_bound(make_pair(a+1,-1));
if(it != s.end()){
it = s.lower_bound(make_pair(it->first+1,-1));
if(it != s.begin()) --it;
if(it->first > a && it->second > b) return;
}
s.insert(make_pair(a,b));
int k = a;
bool ok = 1;
while(ok){
ok = 0;
it = s.lower_bound(make_pair(k,-1));
if(it == s.begin()) break;
--it;
k = it->first;
it = s.lower_bound(make_pair(k,-1));
while(it != s.end() && it->first < a && it->second < b) ok=1,it = s.erase(it);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
int a,b;
cin>>a>>b;
ins(a,b);
cout << s.size() << '\n';
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1888 KiB | ||||
2 | Accepted | 37ms | 2252 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 3ms | 2292 KiB | ||||
4 | Accepted | 3ms | 2376 KiB | ||||
5 | Accepted | 3ms | 2512 KiB | ||||
6 | Accepted | 4ms | 2728 KiB | ||||
subtask3 | 10/10 | ||||||
7 | Accepted | 3ms | 2692 KiB | ||||
8 | Accepted | 3ms | 2696 KiB | ||||
9 | Accepted | 3ms | 2704 KiB | ||||
10 | Accepted | 3ms | 2692 KiB | ||||
11 | Accepted | 3ms | 2688 KiB | ||||
12 | Accepted | 3ms | 2928 KiB | ||||
13 | Accepted | 4ms | 3012 KiB | ||||
14 | Accepted | 4ms | 3168 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 3ms | 3240 KiB | ||||
16 | Accepted | 3ms | 3476 KiB | ||||
17 | Accepted | 3ms | 3712 KiB | ||||
18 | Accepted | 3ms | 3764 KiB | ||||
19 | Accepted | 4ms | 3860 KiB | ||||
20 | Accepted | 8ms | 3844 KiB | ||||
21 | Accepted | 8ms | 4076 KiB | ||||
22 | Accepted | 75ms | 13368 KiB | ||||
subtask5 | 25/25 | ||||||
23 | Accepted | 3ms | 3956 KiB | ||||
24 | Accepted | 3ms | 4088 KiB | ||||
25 | Accepted | 4ms | 4300 KiB | ||||
26 | Accepted | 4ms | 4388 KiB | ||||
27 | Accepted | 18ms | 4468 KiB | ||||
28 | Accepted | 28ms | 4720 KiB | ||||
29 | Accepted | 35ms | 4684 KiB | ||||
30 | Accepted | 35ms | 4644 KiB | ||||
subtask6 | 50/50 | ||||||
31 | Accepted | 3ms | 4592 KiB | ||||
32 | Accepted | 37ms | 4640 KiB | ||||
33 | Accepted | 3ms | 2292 KiB | ||||
34 | Accepted | 3ms | 2376 KiB | ||||
35 | Accepted | 3ms | 2512 KiB | ||||
36 | Accepted | 4ms | 2728 KiB | ||||
37 | Accepted | 3ms | 2692 KiB | ||||
38 | Accepted | 3ms | 2696 KiB | ||||
39 | Accepted | 3ms | 2704 KiB | ||||
40 | Accepted | 3ms | 2692 KiB | ||||
41 | Accepted | 3ms | 2688 KiB | ||||
42 | Accepted | 3ms | 2928 KiB | ||||
43 | Accepted | 4ms | 3012 KiB | ||||
44 | Accepted | 4ms | 3168 KiB | ||||
45 | Accepted | 3ms | 3240 KiB | ||||
46 | Accepted | 3ms | 3476 KiB | ||||
47 | Accepted | 3ms | 3712 KiB | ||||
48 | Accepted | 3ms | 3764 KiB | ||||
49 | Accepted | 4ms | 3860 KiB | ||||
50 | Accepted | 8ms | 3844 KiB | ||||
51 | Accepted | 8ms | 4076 KiB | ||||
52 | Accepted | 75ms | 13368 KiB | ||||
53 | Accepted | 3ms | 3956 KiB | ||||
54 | Accepted | 3ms | 4088 KiB | ||||
55 | Accepted | 4ms | 4300 KiB | ||||
56 | Accepted | 4ms | 4388 KiB | ||||
57 | Accepted | 18ms | 4468 KiB | ||||
58 | Accepted | 28ms | 4720 KiB | ||||
59 | Accepted | 35ms | 4684 KiB | ||||
60 | Accepted | 35ms | 4644 KiB | ||||
61 | Accepted | 4ms | 4596 KiB | ||||
62 | Accepted | 4ms | 4752 KiB | ||||
63 | Accepted | 4ms | 4600 KiB | ||||
64 | Accepted | 37ms | 9304 KiB | ||||
65 | Accepted | 4ms | 4596 KiB | ||||
66 | Accepted | 4ms | 4612 KiB | ||||
67 | Accepted | 4ms | 4688 KiB | ||||
68 | Accepted | 4ms | 4816 KiB | ||||
69 | Accepted | 35ms | 4868 KiB | ||||
70 | Accepted | 239ms | 23512 KiB |