Question: solve with python or c++ Problem S3: Lunch Concert Problem Description It's lunchtime at your school! Your N friends are all standing on a long
solve with python or c++


Problem S3: Lunch Concert Problem Description It's lunchtime at your school! Your N friends are all standing on a long field, as they usually do. The field can be represented as a number line, with the ith friend initially at position P metres along it. The ith friend is able to walk in either direction along the field at a rate of one metre per Wiseconds, and their hearing is good enough to be able to hear music up to and including D, metres away from their position. Multiple students may occupy the same positions on the field, both initially and after walking. You're going to hold a little concert at some position c metres along the field (where c is any integer of your choice), and text all of your friends about it. Once you do, each of them will walk along the field for the minimum amount of time such that they end up being able to hear your concert (in other words, such that each friend i ends up within D; units of c). You'd like to choose c such that you minimize the sum of all N of your friends' walking times. What is this minimum sum in seconds)? Please note that the result might not fit within a 32-bit integer. Input Specification The first line of input contains N. The next N lines contain three space-separated integers, P., W., and D: (1 SIN). The following table shows how the available 15 marks are distributed. 4 marks ISN S 2000 O
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
