PivotOJ

Extraterrestrial Exploration

시간 제한: 1000ms메모리 제한: 1024MB출처: BAPC 2024BOJ 32599

문제

After years of planning and construction, you finally succeeded in making your own spacecraft! Immediately hopping aboard, you take the spaceship on a maiden voyage to the Big Anthropomorphic Pig Constellation. After a couple of years, you reach the constellation and land on the nearest planet to take some pictures and hopefully score some souvenirs. While haggling with a local souvenir seller using the built-in translator of your spacecraft, you are suddenly notified that the craft is low on fuel! Your extensive use of the translator has drained more fuel than expected, and you cannot get back to Earth. Frantically, you look for a refuelling station. Luckily, a local points you to a shady store, strikingly similar to the petrol stations you know from home.

While the outside of the refuelling station may look similar to those on Earth, the inside is completely different. On a long shelf are a number of fuel canisters, with strange symbols on the side. From your research on rocket fuel, you deduce that these symbols probably denote the oxydilation level of the fuel in the canister. None of the rocket fuels burn on their own. Instead, combining two rocket fuels with oxydilation levels oxo_x and oyo_y yields a fuel with burn time oxoy\sqrt{|o_x-o_y|}. You can afford to buy three full canisters, and the burn time of rocket fuel is additive, so that combining rocket fuels with oxydilation levels oxo_x, oyo_y and ozo_z results in a total burn time of \[\sqrt{|o_x-o_y|} + \sqrt{|o_y-o_z|} + \sqrt{|o_z-o_x|}.\] You can only decode the symbols denoting the oxydilation levels with the translator of your spacecraft. Unfortunately, due to the low fuel levels of the spacecraft, you can only use your translator for 5050 items, before the fuel fully runs out. Luckily, you know that rocket fuel is always stored in non-decreasing order of oxydilation levels. Can you figure out which three canisters of rocket fuel to buy to maximize total burn time?

예제

예제 1

입력
4

1

3

3
출력
? 1

? 3

? 4

! 1 2 3

예제 2

입력
6

-5

5

-3

3

-1

1
출력
? 1

? 6

? 2

? 5

? 3

? 4

! 4 6 1
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.