Problem 2. The Lift
Тази задача вече определено ме умори, какво ли не сменям, не мърда до 100. Стигнах макса до 88/100, естествено с всичко входове работи, с мои измислени какви ли не пробвам, всичко точно, но само за джъдж не е точно :)
Ако някой иска да погледне и има идея как да помогне, може би утре на свежа глава пак ще пробвам, че вече мисленето ми дава на късо. Единствено сега се сещам с лист да пробвам, ама пак не се знае какво точно е искал авторът на задачата, може би само той си знае или аз просто нещо пропускам.
https://pastebin.com/N1jhh7P5 88/100
https://judge.softuni.bg/Contests/Practice/Index/2517#1
Programming Fundamentals Mid Exam Retake 12 August 2020
Problem 2. The Lift
Write a program that finds a place for the tourist on a lift.
Every wagon should have a maximum of 4 people on it. If a wagon is full you should direct the people to the next one with space available.
Input
- On the first line you, will receive how many people are waiting to get on the lift
- On the second line, you will you will receive the current state of the lift separated by " ".
Output
When there is no more available space left on the lift, or there are no more people in the queue, you should print on the console the final state of the lift's wagons separated by " " and one of the following messages:
- If there are no more people and the lift have empty spots you should print:
"The lift has empty spots!
{wagons separated by ' '}"
- If there are still people on the queue and no more available space, you should print:
"There isn't enough space! {people} people in a queue!
{wagons separated by ' '}"
- If the lift is full and there are no more people in the queue, you should print only the wagons separated by " "
Examples
Input |
Output |
15 0 0 0 0 |
The lift has empty spots! 4 4 4 3 |
Comment |
|
First state - 4 0 0 0 -> 11 people left Second state – 4 4 0 0 -> 7 people left Third state – 4 4 4 0 -> 3 people left |
|
Input |
Output |
20 0 2 0 |
There isn't enough space! 10 people in a queue! 4 4 4 |
Comment |
|
First state - 4 2 0 -> 16 people left Second state – 4 4 0 -> 14 people left Third state – 4 4 4 -> 10 people left, but there’re no more waggons. |