Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

hristo12319 avatar hristo12319 1 Точки

Проблем с Problem 2 - The Lift от mid-exam Fundamentals

Ще се радвам ако ми обясните защо в judge получавам 70/100. Zero-тестовете са верни, но явно някъде има някаква грешка

Ще се радвам ако погледнете решението ми и ми кажете къде точно греша?

Ето линк: https://pastebin.com/iKBwgcpV

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 receive the current state of the lift separated by a single space: " ".

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 in 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 wagons.

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 receive the current state of the lift separated by a single space: " ".

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 in 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 wagons.

Тагове:
0
Fundamentals Module 07/05/2022 20:26:01
tomusa avatar tomusa -3 Точки

I really like the information you share. Thanks to that, I know much more interesting contexto game and useful things. fall guys 

-1
1
destintorp avatar destintorp -1 Точки

Thanks to your writing, I now find the issue at hand to be quite engaging. I think a lot of other people are curious about them too. How much time do you think is needed to finish this article? I really appreciate you sharing these excellent articles with the world. Many people, I think, will be taken aback after reading this article. Many thanks for your contribution! the backrooms

-1
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.