Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <map>
- using namespace std;
- int main() {
- string line;
- getline(cin, line);
- map<int, int> starts;
- map<int, int> ends;
- int from, to;
- for (int i = 1; line != "."; i++) {
- istringstream ss(line);
- ss >> from;
- starts.insert({ from, i });
- ss >> to;
- ends.insert({ to, i });
- getline(cin, line);
- }
- getline(cin, line);
- while (line != ".") {
- auto start = starts.upper_bound(stoi(line));
- auto end = ends.lower_bound(stoi(line));
- bool isRange = start != starts.begin() && ((--start)->second == end->second);
- cout << (isRange ? "in" : "out") << endl;
- getline(cin, line);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement