#include <iostream>
#include <queue>
#define ll long long
using namespace std;
struct alk
{
ll els,mas;
};
priority_queue<alk>que;
bool operator<(const alk a, const alk b)
{
if(a.els>b.els)return true;
else if(a.els==b.els && a.mas>b.mas)return true;
return false;
}
struct alk2
{
ll els, mas;
};
priority_queue<alk2>que2;
bool operator<(const alk2 a, const alk2 b)
{
if(a.els<b.els)return true;
else if(a.els==b.els && a.mas<b.mas)return true;
return false;
}
int main() {
ll n;
cin >> n;
for (int i = 1; i <= n; ++i) {
ll a, b;
cin >> a >> b;
if(!que2.empty() &&(que2.top().els<=a||que2.top().mas<=b))
{
que2.push({a, b});
que.push({a,b});
}
if(que2.empty())
{
que2.push({a,b});
que.push({a,b});
}
while (!que.empty() && a > que.top().els && b > que.top().mas) {
que.pop();
}
cout << que.size() << "\n";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 2032 KiB | ||||
2 | Wrong answer | 180ms | 8720 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 3ms | 2436 KiB | ||||
4 | Accepted | 3ms | 2560 KiB | ||||
5 | Accepted | 4ms | 2508 KiB | ||||
6 | Accepted | 18ms | 2640 KiB | ||||
subtask3 | 0/10 | ||||||
7 | Accepted | 3ms | 2848 KiB | ||||
8 | Accepted | 3ms | 2988 KiB | ||||
9 | Accepted | 3ms | 3192 KiB | ||||
10 | Wrong answer | 3ms | 3464 KiB | ||||
11 | Wrong answer | 3ms | 3648 KiB | ||||
12 | Wrong answer | 4ms | 3732 KiB | ||||
13 | Wrong answer | 8ms | 4000 KiB | ||||
14 | Wrong answer | 12ms | 4428 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 3ms | 4164 KiB | ||||
16 | Accepted | 3ms | 4284 KiB | ||||
17 | Accepted | 4ms | 4380 KiB | ||||
18 | Accepted | 6ms | 4504 KiB | ||||
19 | Accepted | 20ms | 4712 KiB | ||||
20 | Accepted | 35ms | 4816 KiB | ||||
21 | Accepted | 54ms | 4728 KiB | ||||
22 | Accepted | 231ms | 11160 KiB | ||||
subtask5 | 0/25 | ||||||
23 | Wrong answer | 3ms | 4724 KiB | ||||
24 | Wrong answer | 4ms | 4752 KiB | ||||
25 | Wrong answer | 10ms | 4944 KiB | ||||
26 | Wrong answer | 16ms | 5020 KiB | ||||
27 | Wrong answer | 108ms | 7544 KiB | ||||
28 | Wrong answer | 167ms | 6492 KiB | ||||
29 | Wrong answer | 188ms | 7604 KiB | ||||
30 | Wrong answer | 270ms | 10172 KiB | ||||
subtask6 | 0/50 | ||||||
31 | Accepted | 3ms | 4752 KiB | ||||
32 | Wrong answer | 268ms | 11308 KiB | ||||
33 | Accepted | 3ms | 2436 KiB | ||||
34 | Accepted | 3ms | 2560 KiB | ||||
35 | Accepted | 4ms | 2508 KiB | ||||
36 | Accepted | 18ms | 2640 KiB | ||||
37 | Accepted | 3ms | 2848 KiB | ||||
38 | Accepted | 3ms | 2988 KiB | ||||
39 | Accepted | 3ms | 3192 KiB | ||||
40 | Wrong answer | 3ms | 3464 KiB | ||||
41 | Wrong answer | 3ms | 3648 KiB | ||||
42 | Wrong answer | 4ms | 3732 KiB | ||||
43 | Wrong answer | 8ms | 4000 KiB | ||||
44 | Wrong answer | 12ms | 4428 KiB | ||||
45 | Accepted | 3ms | 4164 KiB | ||||
46 | Accepted | 3ms | 4284 KiB | ||||
47 | Accepted | 4ms | 4380 KiB | ||||
48 | Accepted | 6ms | 4504 KiB | ||||
49 | Accepted | 20ms | 4712 KiB | ||||
50 | Accepted | 35ms | 4816 KiB | ||||
51 | Accepted | 54ms | 4728 KiB | ||||
52 | Accepted | 231ms | 11160 KiB | ||||
53 | Wrong answer | 3ms | 4724 KiB | ||||
54 | Wrong answer | 4ms | 4752 KiB | ||||
55 | Wrong answer | 10ms | 4944 KiB | ||||
56 | Wrong answer | 16ms | 5020 KiB | ||||
57 | Wrong answer | 108ms | 7544 KiB | ||||
58 | Wrong answer | 167ms | 6492 KiB | ||||
59 | Wrong answer | 188ms | 7604 KiB | ||||
60 | Wrong answer | 270ms | 10172 KiB | ||||
61 | Wrong answer | 16ms | 5072 KiB | ||||
62 | Wrong answer | 13ms | 5296 KiB | ||||
63 | Wrong answer | 14ms | 5012 KiB | ||||
64 | Accepted | 90ms | 8400 KiB | ||||
65 | Wrong answer | 12ms | 5132 KiB | ||||
66 | Wrong answer | 10ms | 5300 KiB | ||||
67 | Wrong answer | 14ms | 5292 KiB | ||||
68 | Wrong answer | 14ms | 5116 KiB | ||||
69 | Wrong answer | 159ms | 5316 KiB | ||||
70 | Time limit exceeded | 442ms | 10624 KiB |