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

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

Cheap Flying

면접 대비

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

요약
항공편당 항공사 이용 요금과 항공기 구매 비용 및 항공편당 연료비가 주어질 때, 총비용이 사전 최적 비용의 두 배를 넘지 않도록 전환 시점을 온라인으로 결정한다.
난이도

보통10점 중 4점

유형
그리디, 수학, 구현
정답자
아직 제출이 없습니다

문제

You are part of the organization of BAPC, and you are in charge of flight operations. From time to time, the jury members of BAPC need to fly from the remote headquarters of BAPC to the current location of the operation that BAPC performs, which is currently Amsterdam. Luckily there is an airline that serves the route from BAPC's headquarters to Amsterdam. The BAPC organization has a contract with that airline that ensures that you pay the same fixed amount for each flight. If your judges need to fly the route often, these costs can add up and become really high. To avoid this, you figured out that you could also simply buy your own aircraft. Once you own your own aircraft, you can either fly with this new shiny equipment which costs some fixed price per flight for fuel and the like, or alternatively you could still fly with the airline.

The problem now is that you have no idea what the judges are doing! They are so incredibly unpredictable and always only do random and very complicated things. So random, that you cannot decide beforehand what you should do. So you need to make your decision on the fly, even though this may prevent you from making the cost-optimal decision up-front. Still, you do not want to be too loose with your spending: you set yourself the constraint that you spend at most twice as much as you would have if you exactly knew how many flights the judges would make in advance.

예제2

  1. 예제 1

    입력
    5 50 2
    flight
    
    flight
    
    flight
    
    end
    
    예상 출력
    
    airline
    
    airline
    
    airline
    
    
  2. 예제 2

    입력
    5 8 1
    flight
    
    flight
    
    end
    
    예상 출력
    
    buy
    
    self