RUVIDEO
Поделитесь видео 🙏

Hostel Room Problem Code: HOSTELROOM | CodeChef Solution | Python3

There are initially X people in a room.

You are given an array A of length N which describes the following events:

then Ai people enter the room at i-th minute. For e.g. if A2=3, then 3 people enter the room at the 2-nd minute.
then |Ai| people leave the room at i-th minute. Here |Ai| denotes the absolute value of Ai. For e.g. if A4=−2, then 2 people leave the room at the 4-th minute.
Determine the maximum number of people in the room at any moment of time.

It is guaranteed in the input that at any moment of time, the number of people in the room does not become negative.

Input Format
The first line will contain T - the number of test cases. Then the test cases follow.
The first line of each test case consists of two integers N and X - the length of the array A and the number of people in the room initially.
The second line of each test case contains N integers A1,A2,A3,…AN.
Output Format
For each testcase, output the maximum number of people in the room at any point of time.

Sample Input 1
3
5 8
0 3 3 -13 5
4 5
0 -2 2 3
3 5
-2 5 -2
Sample Output 1
14
8
8
Explanation
Test case-1: In the 3-rd minute, the room contains 8+0+3+3=14 people which is the maximum number of people in the room at any point of time.

Test case-2: In the 4-th minute, the room contains 5+0−2+2+3=8 people which is the maximum number of people in the room at any point of time.

Test case-3: In the 2-nd minute, the room contains 5−2+5=8 people which is the maximum number of people in the room at any point of time.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Hostel Room Problem Code: HOSTELROOM | CodeChef Solution | Python3», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.