Finn the Giant
면접 대비시간 제한1초메모리 제한1024 MB
각 기둥은 가장 가까운 지붕 구간을 지지하며, 핀이 기둥 하나를 무너뜨리면 하중이 재분배되어 지지력을 초과한 기둥이 연쇄적으로 무너진다. 가장 많은 기둥을 무너뜨릴 기둥 하나를 찾는다.
문제
Frustrated by his legendary inability to tear down Lund's Cathedral, Finn the Giant wants to become better at destroying pillar-borne edifices. Together with his fellow trolls he has constructed a training site consisting of a colonnade of various pillars supporting a roof. The pillars differ in structural strength---some are hewn of Swedish granite, but in various styles, others are made of stone, clay, or even wood. The roof his a huge block of uniform granite. You can assume that in the beginning, each pillar is able to support its own part of the roof. The pillars have exactly the same distance.

As an experienced builder, Finns known enough structural engineering to understand how roof weight distributes across pillars: every pillar supports the part of the roof closest to it. After removing pillars 1 and 2, the middle pillar supports the shaded part of the roof:

At the left of pillar 0 and to the right of pillar , the roof is supported by two indestructible pillars. Initially, every pillar is subject to the same pressure, 1000 kN.
Finn is able to tear down exactly one of the internal pillars, independent of its structural integrity. He hopes to start a chain reaction, whereby the redistribution of the roof's weights results in other pillars being crushed. Which pillar should Finn tear down to create the maximum damage?
입력
Input consists of two lines. On the first row, the number of pillars, with . On the second row, integers , , , where , representing how much each internal pillar can support (in kN), from left to right.
출력
A single line with two integers. First the maximal damage (counted in number of destroyed pillars) that Finn can cause. Second, the pillar he has to tear down. The internal pillars are numbered , , , . If there are more than one correct answers, any will do.