10797 | 2024-04-14 11:34:50 | Ablablabla | Főnökszám | cpp17 | Wrong answer 40/100 | 377ms | 65908 KiB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int akt = 0;
set<int> a;
multiset<int> b[MAXN];
void torol(int x, int y){
auto it = a.lower_bound(x);
while(it != a.begin()){
it--;
int ert = *it;
auto itB = b[ert].begin();
while(itB != b[ert].end() && *itB <= y){
akt--;
itB = b[ert].erase(itB);
}
if(b[ert].empty()){
a.erase(ert);
it = a.lower_bound(x);
} else{
break;
}
}
}
void beszur(int x, int y){
akt++;
a.insert(x);
b[x].insert(y);
}
void berak(int x, int y){
auto it = a.upper_bound(x);
if(it == a.end()){
beszur(x, y);
} else{
int ert = *it;
if(*b[ert].rbegin() <= y){
beszur(x, y);
}
}
}
int main()
{
int n;
cin >> n;
vector<int> alapA(n), alapB(n), nyom(n);
for(int i = 0; i < n; i++){
cin >> alapA[i] >> alapB[i];
nyom[i] = alapA[i];
}
sort(nyom.begin(), nyom.end());
nyom.erase(unique(nyom.begin(), nyom.end()), nyom.end());
for(int &x : alapA){
x = lower_bound(nyom.begin(), nyom.end(), x) - nyom.begin();
}
for(int i = 0; i < n; i++){
torol(alapA[i], alapB[i]);
berak(alapA[i], alapB[i]);
cout << akt << "\n";
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 12ms | 20804 KiB | ||||
2 | Wrong answer | 119ms | 23224 KiB | ||||
subtask2 | 5/5 | ||||||
3 | Accepted | 10ms | 21072 KiB | ||||
4 | Accepted | 10ms | 21372 KiB | ||||
5 | Accepted | 10ms | 21244 KiB | ||||
6 | Accepted | 18ms | 21792 KiB | ||||
subtask3 | 0/10 | ||||||
7 | Accepted | 8ms | 21880 KiB | ||||
8 | Accepted | 8ms | 21976 KiB | ||||
9 | Accepted | 8ms | 22264 KiB | ||||
10 | Accepted | 10ms | 22452 KiB | ||||
11 | Wrong answer | 10ms | 22664 KiB | ||||
12 | Accepted | 10ms | 22516 KiB | ||||
13 | Accepted | 14ms | 22548 KiB | ||||
14 | Accepted | 16ms | 22564 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 9ms | 22504 KiB | ||||
16 | Accepted | 10ms | 22580 KiB | ||||
17 | Accepted | 10ms | 22776 KiB | ||||
18 | Accepted | 13ms | 22996 KiB | ||||
19 | Accepted | 18ms | 23172 KiB | ||||
20 | Accepted | 30ms | 23500 KiB | ||||
21 | Accepted | 32ms | 23500 KiB | ||||
22 | Accepted | 111ms | 34876 KiB | ||||
subtask5 | 25/25 | ||||||
23 | Accepted | 9ms | 23224 KiB | ||||
24 | Accepted | 9ms | 23232 KiB | ||||
25 | Accepted | 12ms | 23536 KiB | ||||
26 | Accepted | 14ms | 23340 KiB | ||||
27 | Accepted | 64ms | 24416 KiB | ||||
28 | Accepted | 97ms | 25120 KiB | ||||
29 | Accepted | 119ms | 25464 KiB | ||||
30 | Accepted | 119ms | 25616 KiB | ||||
subtask6 | 0/50 | ||||||
31 | Accepted | 8ms | 23476 KiB | ||||
32 | Wrong answer | 119ms | 25468 KiB | ||||
33 | Accepted | 10ms | 21072 KiB | ||||
34 | Accepted | 10ms | 21372 KiB | ||||
35 | Accepted | 10ms | 21244 KiB | ||||
36 | Accepted | 18ms | 21792 KiB | ||||
37 | Accepted | 8ms | 21880 KiB | ||||
38 | Accepted | 8ms | 21976 KiB | ||||
39 | Accepted | 8ms | 22264 KiB | ||||
40 | Accepted | 10ms | 22452 KiB | ||||
41 | Wrong answer | 10ms | 22664 KiB | ||||
42 | Accepted | 10ms | 22516 KiB | ||||
43 | Accepted | 14ms | 22548 KiB | ||||
44 | Accepted | 16ms | 22564 KiB | ||||
45 | Accepted | 9ms | 22504 KiB | ||||
46 | Accepted | 10ms | 22580 KiB | ||||
47 | Accepted | 10ms | 22776 KiB | ||||
48 | Accepted | 13ms | 22996 KiB | ||||
49 | Accepted | 18ms | 23172 KiB | ||||
50 | Accepted | 30ms | 23500 KiB | ||||
51 | Accepted | 32ms | 23500 KiB | ||||
52 | Accepted | 111ms | 34876 KiB | ||||
53 | Accepted | 9ms | 23224 KiB | ||||
54 | Accepted | 9ms | 23232 KiB | ||||
55 | Accepted | 12ms | 23536 KiB | ||||
56 | Accepted | 14ms | 23340 KiB | ||||
57 | Accepted | 64ms | 24416 KiB | ||||
58 | Accepted | 97ms | 25120 KiB | ||||
59 | Accepted | 119ms | 25464 KiB | ||||
60 | Accepted | 119ms | 25616 KiB | ||||
61 | Wrong answer | 16ms | 23404 KiB | ||||
62 | Wrong answer | 14ms | 23412 KiB | ||||
63 | Wrong answer | 13ms | 23412 KiB | ||||
64 | Accepted | 61ms | 29244 KiB | ||||
65 | Wrong answer | 14ms | 23420 KiB | ||||
66 | Wrong answer | 14ms | 23428 KiB | ||||
67 | Wrong answer | 14ms | 23676 KiB | ||||
68 | Wrong answer | 14ms | 23680 KiB | ||||
69 | Wrong answer | 92ms | 25992 KiB | ||||
70 | Accepted | 377ms | 65908 KiB |