Help me finish this, the other answer here in answers is not working #include #include using namespace
Posted: Sun Jul 03, 2022 9:59 am
Help me finish this, the other answer here in answers is notworking
#include <iostream>
#include <queue>
using namespace std;
struct crew
{
int hc;
int st;
int et;
};
struct guest
{
int h;
int t;
};
int main()
{
crew *Crew;
guest Guest;
queue <guest> GuestLine;
int H, C, Q;
cin >> H >> C >> Q;
Crew = new crew[C];
cout << endl << "Crew Information..."<< endl;
for (int i = 0; i < C; i++)
cin >> Crew.hc >> Crew.st>> Crew.et;
cout << endl << "Guest Information..."<< endl << endl;
for (int i = 0; i < Q; i++)
{
cin >> Guest.h >> Guest.t;
GuestLine.push(Guest);
}
cout << "\nOutput...\n";
while (!GuestLine.empty())
{
//write your codes here...
}
}
1 #include 2 #include 3 4 using namespace std; 5 6 struct crew { 7 int hc; int st; int et; 8 9 10 }; #229959227222227228223 11 12 13. 14 15 16 18 17 int main() { 19 20 21 24 26 30 31 struct guest { int h; int t; 33 34 35 20 }; crew* Crew; guest Guest; queue GuestLine; int H, C, Q; cin >> H >> C >> Q; Crew = new crew [C]; cout << endl << "Crew Information..." << endl; for (int i = 0; i < C; i++) { cin >> Crew.hc >> Crew.st >> Crew .et; } cout << endl << "Guest Information..." << endl; for (int i = 0; i < Q; i++) { cin >> Guest.h>> Guest.t; GuestLine.push(Guest); } cout << "\nOutput...\n"; while (!GuestLine.empty()) { guest g = GuestLine.front (); Collapse Eerie Planet You own a club on eerie planet. The day on this planet comprises of H hours. You appointed C crew members to handle the huge crowd that you get, being the best club on the planet. Each member of the crew has fixed number of duty hours to work. There can be multiple or no crew members at work at any given hour of the day. Being on weird planet, the rules of this club cannot be normal. Each member of the crew only allows people who are taller than him to enter the club when he is at work. Given the schedule of work and heights of the crew members. you have to answer Q queries. Each query specifies the time of entry and height of a person who is visiting the club. You have to answer if the person will be allowed to enter the club or not. Next > KX KM
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 47 48 49 50 51 52 } crew Crew; guest Guest; queue GuestLine; int H, C, Q; cin >> H >> C >> Q; Crew = new crew [C]; cout << endl << "Crew Information..." << endl; for (int i = 0; i < C; i++) { cin >> Crew.hc >> Crew.st >> Crew.et; } cout << endl << "Guest Information..." << endl; for (int i = 0; i < Q; i++) { cin >> Guest.h>> Guest.t; GuestLine.push (Guest); } cout << "\nOutput...\n"; while (!GuestLine.empty()) { } guest g = GuestLine. front (); bool eligible = true; for (int i = 0; i < C; i++) { if(g.t >= Crew.st && g.t <= Crew[i].et && g.h <= Crew[i].hc) { eligible = false; break; } } if(eligible) { cout << "YES"; } else { cout << "NO"; } cout << endl; GuestLine.pop(); Collapse Input Specifications • First line of the input contains 3 integers, H, C, Q. Representing number of hours in a day (H), number of crew members [C] and number of queries respectively (Q). • Next © lines follow, where each line contains 3 integers, hi, Si, Ei, representing height of the crew member(hi) and start (Si) and end hour (Ei) of his/her work schedule. He/she works for hours [Si, Ei], both inclusive. • Next (Q) lines follow, each containing 2 integers, hi, ti, representing height (hi) and time (ti) (in hour) of the person trying to enter the club. Next > <) (> * KX
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 47 48 49 50 51 52 } crew* Crew; guest Guest; queue GuestLine; int H, C, Q; cin>> H >> C >> Q; Crew = new crew [C]; cout << endl << "Crew Information..." << endl; for (int i = 0; i < C; i++) { cin >> Crew[i].hc >> Crew [i].st >> Crew[i].et; } cout << endl<< "Guest Information..." << endl; for (int i = 0; i < 0; i++) { cin >> Guest.h>> Guest.t; GuestLine.push (Guest); } cout << "\nOutput...\n"; while (!GuestLine.empty()) { } guest g = GuestLine. front (); bool eligible = true; for (int i = 0; i < C; i++) { if(g.t >= Crew [i].st && g.t <= Crew[i].et && g.h <= Crew[i].hc) { eligible = false; break; } } if(eligible) { cout << "YES"; } else { cout << "NO"; } cout << endl; GuestLine.pop(); Collapse Output Specifications . (Q) lines, each line containing "YES" or "NO", without the quotes, answering if the person will be allowed to enter the club or not. Requirement: Use STL queue • See sample run below: . SAMPLE INPUT 10 15 50 2 6 10 1 10 2 50 5 51 6 100 10 Next ► SAMPLE OUTPUT YES NO NO YES YES * RX
#include <iostream>
#include <queue>
using namespace std;
struct crew
{
int hc;
int st;
int et;
};
struct guest
{
int h;
int t;
};
int main()
{
crew *Crew;
guest Guest;
queue <guest> GuestLine;
int H, C, Q;
cin >> H >> C >> Q;
Crew = new crew[C];
cout << endl << "Crew Information..."<< endl;
for (int i = 0; i < C; i++)
cin >> Crew.hc >> Crew.st>> Crew.et;
cout << endl << "Guest Information..."<< endl << endl;
for (int i = 0; i < Q; i++)
{
cin >> Guest.h >> Guest.t;
GuestLine.push(Guest);
}
cout << "\nOutput...\n";
while (!GuestLine.empty())
{
//write your codes here...
}
}
1 #include 2 #include 3 4 using namespace std; 5 6 struct crew { 7 int hc; int st; int et; 8 9 10 }; #229959227222227228223 11 12 13. 14 15 16 18 17 int main() { 19 20 21 24 26 30 31 struct guest { int h; int t; 33 34 35 20 }; crew* Crew; guest Guest; queue GuestLine; int H, C, Q; cin >> H >> C >> Q; Crew = new crew [C]; cout << endl << "Crew Information..." << endl; for (int i = 0; i < C; i++) { cin >> Crew.hc >> Crew.st >> Crew .et; } cout << endl << "Guest Information..." << endl; for (int i = 0; i < Q; i++) { cin >> Guest.h>> Guest.t; GuestLine.push(Guest); } cout << "\nOutput...\n"; while (!GuestLine.empty()) { guest g = GuestLine.front (); Collapse Eerie Planet You own a club on eerie planet. The day on this planet comprises of H hours. You appointed C crew members to handle the huge crowd that you get, being the best club on the planet. Each member of the crew has fixed number of duty hours to work. There can be multiple or no crew members at work at any given hour of the day. Being on weird planet, the rules of this club cannot be normal. Each member of the crew only allows people who are taller than him to enter the club when he is at work. Given the schedule of work and heights of the crew members. you have to answer Q queries. Each query specifies the time of entry and height of a person who is visiting the club. You have to answer if the person will be allowed to enter the club or not. Next > KX KM
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 47 48 49 50 51 52 } crew Crew; guest Guest; queue GuestLine; int H, C, Q; cin >> H >> C >> Q; Crew = new crew [C]; cout << endl << "Crew Information..." << endl; for (int i = 0; i < C; i++) { cin >> Crew.hc >> Crew.st >> Crew.et; } cout << endl << "Guest Information..." << endl; for (int i = 0; i < Q; i++) { cin >> Guest.h>> Guest.t; GuestLine.push (Guest); } cout << "\nOutput...\n"; while (!GuestLine.empty()) { } guest g = GuestLine. front (); bool eligible = true; for (int i = 0; i < C; i++) { if(g.t >= Crew.st && g.t <= Crew[i].et && g.h <= Crew[i].hc) { eligible = false; break; } } if(eligible) { cout << "YES"; } else { cout << "NO"; } cout << endl; GuestLine.pop(); Collapse Input Specifications • First line of the input contains 3 integers, H, C, Q. Representing number of hours in a day (H), number of crew members [C] and number of queries respectively (Q). • Next © lines follow, where each line contains 3 integers, hi, Si, Ei, representing height of the crew member(hi) and start (Si) and end hour (Ei) of his/her work schedule. He/she works for hours [Si, Ei], both inclusive. • Next (Q) lines follow, each containing 2 integers, hi, ti, representing height (hi) and time (ti) (in hour) of the person trying to enter the club. Next > <) (> * KX
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 47 48 49 50 51 52 } crew* Crew; guest Guest; queue GuestLine; int H, C, Q; cin>> H >> C >> Q; Crew = new crew [C]; cout << endl << "Crew Information..." << endl; for (int i = 0; i < C; i++) { cin >> Crew[i].hc >> Crew [i].st >> Crew[i].et; } cout << endl<< "Guest Information..." << endl; for (int i = 0; i < 0; i++) { cin >> Guest.h>> Guest.t; GuestLine.push (Guest); } cout << "\nOutput...\n"; while (!GuestLine.empty()) { } guest g = GuestLine. front (); bool eligible = true; for (int i = 0; i < C; i++) { if(g.t >= Crew [i].st && g.t <= Crew[i].et && g.h <= Crew[i].hc) { eligible = false; break; } } if(eligible) { cout << "YES"; } else { cout << "NO"; } cout << endl; GuestLine.pop(); Collapse Output Specifications . (Q) lines, each line containing "YES" or "NO", without the quotes, answering if the person will be allowed to enter the club or not. Requirement: Use STL queue • See sample run below: . SAMPLE INPUT 10 15 50 2 6 10 1 10 2 50 5 51 6 100 10 Next ► SAMPLE OUTPUT YES NO NO YES YES * RX