아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Finn the Giant

면접 대비

시간 제한1초메모리 제한1024 MB

요약
각 기둥은 가장 가까운 지붕 구간을 지지하며, 핀이 기둥 하나를 무너뜨리면 하중이 재분배되어 지지력을 초과한 기둥이 연쇄적으로 무너진다. 가장 많은 기둥을 무너뜨릴 기둥 하나를 찾는다.
난이도

보통10점 중 7점

유형
배열, 시뮬레이션, 누적 합, 구현
정답자
아직 제출이 없습니다

문제

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 n−1n-1, 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 nn of pillars, with 1≤n≤100,0001\leq n\leq 100\\,000. On the second row, nn integers b_0b\_0, …\ldots, b_n−1b\_{n-1}, where 1,000≤b_i≤100,000,0001\\,000 \leq b\_i\leq 100\\,000\\,000, 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 00, 11, …\ldots, n−1n-1. If there are more than one correct answers, any will do.

예제2

  1. 예제 1

    입력
    5
    1341 2412 1200 3112 2391
    
    예상 출력
    3 1
    
  2. 예제 2

    입력
    5
    1004 1003 1002 1001 1000
    
    예상 출력
    5 0