Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question To encourage in-house sales a popular pizza franchise decided to give a free slice of pizza with each in- house purchase. The entire
Question To encourage in-house sales a popular pizza franchise decided to give a free slice of pizza with each in- house purchase. The entire country is already waiting for the pizza place to open. There are x people waiting in a line all six feet apart. The people are numbered 1 through x in line order. with person I being the one currently closest to the door of the pizza place. During the next few hours, some people use tricks in order to skip to the beginning of the queue. Some of the lore popular tricks include: Look over there, isn't that [famous Soca Artist e.g., Machel Montano]? Please, my child is hungry can you let me through? Excuse me I was here before you I just went to the bathroom. What is wrong with that guy? He's trying to skip the line. Let me go and throw him out! You are given the sequence of people skipping to the front of the queue. After all those events, the pizza store will open. To observe Covid-19 protocols, people will enter the store one at a time. Write a program, Ql.cpp, to determine who will spend the most time waiting for their free slice. In other words, find out who will be the last person in the queue after all the skipping to the front is over. The data is captured in a data file, input.txt. The first line of the input file contains an integer, 1. specifying the number of test cases. Each test case is preceded by a blank line. Each test case starts with a line containing two positive integers n and e: the number of people and the number of events respectively. The rest of the test case consists of e lines, each containing a single positive integer indicating: the number of the person who just moved to the front of the queue.
Step by Step Solution
★★★★★
3.54 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
include include using namespace std int main ifstream input inputopeninputtxt int r input r forint t ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started