-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathdentista.cpp
More file actions
46 lines (34 loc) · 755 Bytes
/
dentista.cpp
File metadata and controls
46 lines (34 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// JDENTIST
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, x, y, counter=0, status=1;
vector<int> consult;
vector< vector<int> > memo;
cin >> n;
while (n--) {
cin >> x;
cin >> y;
if (!memo.empty()) {
for (int i = 0; i < memo.size(); i++) {
if ((x < memo[i][0] && y <= memo[i][0]) || (x >= memo[i][1] && y > memo[i][1])) {
} else {
status = 0;
}
}
}
if (status) {
counter++;
consult.push_back(x);
consult.push_back(y);
memo.push_back(consult);
}
status = 1;
consult.clear();
}
for(int i = 0; i < memo.size(); i++) {
cout << memo[i][0] << " - " << memo[i][1] << endl;
}
cout << counter;
}