codeforces 551 C GukiZ hates Boxes

Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.

In total there arenpiles of boxes, arranged in a line, from left to right,i-th pile (1≤i≤n) containingaiboxes. Luckily,mstudents are willing to help GukiZ by removing all the boxes from his way. Students are working simultaneously. At time0, all students are located left of the first pile. It takes one second for every student to move from this position to the first pile, and after that, every student must start performing sequence of two possible operations, each taking one second to complete. Possible operations are:

Ifi≠n, move from pileito pilei+1;If pile located at the position of student is not empty, remove one box from it.

GukiZ’s students aren’t smart at all, so they need you to tell them how to remove boxes before professor comes (he is very impatient man, and doesn’t want to wait). They ask you to calculate minumum timetin seconds for which they can remove all the boxes from GukiZ’s way. Note that students can be positioned in any manner aftertseconds, but all the boxes must be removed.

,学会技能是小智慧,学会做人是大智慧。

codeforces 551 C GukiZ hates Boxes

相关文章:

你感兴趣的文章:

标签云: