Advertisement
jasonpogi1669

Eerie Planet using C++

Feb 11th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. using namespace std;
  4.  
  5. struct crew {
  6.     int hc;
  7.     int st;
  8.     int et;
  9. };
  10.  
  11. struct guest {
  12.     int h;
  13.     int t;
  14. };
  15.  
  16. int main() {
  17.     crew *Crew;
  18.     guest Guest;
  19.     queue <guest> GuestLine;
  20.     int H, C, Q;
  21.     cin >> H >> C >> Q;
  22.     Crew = new crew[C];
  23.     cout << endl << "Crew Information..." << endl;
  24.     for (int i = 0; i < C; i++) {
  25.         cin >> Crew[i].hc >> Crew[i].st >> Crew[i].et;
  26.     }
  27.     cout << endl << "Guest Information..." << endl << endl;
  28.     for (int i = 0; i < Q; i++) {
  29.         cin >> Guest.h >> Guest.t;
  30.         GuestLine.push(Guest);
  31.     }
  32.     cout << "\nOutput...\n";
  33.     while (!GuestLine.empty()) {
  34.         bool checker = true;
  35.         for (int i = 0; i < C; i++) {
  36.             if (GuestLine.front().t >= Crew[i].st && GuestLine.front().t <= Crew[i].et && GuestLine.front().t <= H) {
  37.                 if (GuestLine.front().h <= Crew[i].hc) {
  38.                     checker = false;
  39.                     break;
  40.                 }
  41.             }
  42.         }
  43.         cout << (checker ? "YES" : "NO") << endl;
  44.         GuestLine.pop();
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement