Logo
(追記) (追記ここまで)

30307번 - Cheap Flying 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB68282642.623%

문제

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.

인터랙션

This is an interactive problem. Your submission will be run against an interactor, which reads from the standard output of your submission and writes to the standard input of your submission. This interaction needs to follow a specific protocol:

The interactor first sends one line with three integers $a,ドル $b,ドル and $c$ (0ドル\leq a,b,c\leq 10^6$), the cost of one flight with the airline, the one-time cost of buying an aircraft, and the cost for each flight using your own aircraft.

Then, the interactor sends either the input "flight" or the input "end". For every input "flight", you need to provide either "airline" if you want fly with the airline for cost $a,ドル "buy" to buy an aircraft and use it for a single flight for cost $b+c,ドル or "self" if you want to use your own aircraft for cost $c$. You can only use the last option if you have bought an aircraft before, and you can only buy an aircraft once.

The interaction ends when you receive the input "end", which is after at most 10ドル^4$ rounds.

The interactor is adaptive, and may send fewer or more flights based on your output.

Make sure you flush the buffer after each write.

A testing tool is provided to help you develop your solution.

입력

출력

제한

예제 입력 1

5 50 2
flight
flight
flight
end

예제 출력 1

airline
airline
airline

예제 입력 2

5 8 1
flight
flight
end

예제 출력 2

buy
self

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2023 Preliminaries C번

  • 문제를 만든 사람: Gregor Behnke

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /