CF907A.Masha and Bears

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larger than the middle car, and the middle car is strictly larger than the smallest car.

Masha came to test these cars. She could climb into all cars, but she liked only the smallest car.

It's known that a character with size a can climb into some car with size b if and only if a ≤ b, he or she likes it if and only if he can climb into this car and 2_a_ ≥ b.

You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.

由熊爸爸、熊妈妈和熊宝宝组成的一家拥有三辆汽车。熊爸爸能进入最大的汽车,且他喜欢这辆车;熊妈妈能进入中等大小的汽车,且她喜欢这辆车;熊宝宝能进入最小的汽车,且他喜欢这辆车。已知:最大的汽车严格大于中等大小的汽车,中等大小的汽车严格大于最小的汽车。

玛莎来试驾这些汽车。她能够进入所有三辆汽车,但只喜欢最小的那辆。

已知:一个尺寸为 aa 的角色能够进入一辆尺寸为 bb 的汽车,当且仅当 a≤ba \leq b;他或她喜欢这辆汽车,当且仅当他/她能进入该车且 2a≥b2a \geq b。

现给出三只熊及玛莎各自的尺寸,请找出一组可能的、非负整数的汽车尺寸。

输入格式

You are given four integers _V_1, _V_2, _V_3, V__m(1 ≤ V__i ≤ 100) — sizes of father bear, mother bear, son bear and Masha, respectively. It's guaranteed that _V_1 > _V_2 > _V_3.

给你四个整数 V1V_1、V2V_2、V3V_3、VmV_m(1 ≤ Vi ≤ 1001 ≤ V_i ≤ 100),分别表示熊爸爸、熊妈妈、熊儿子和玛莎的体积。保证 V1 > V2 > V3V_1 > V_2 > V_3。

输出格式

Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively.

If there are multiple possible solutions, print any.

If there is no solution, print "-1" (without quotes).

输出三个整数——分别为熊爸爸的汽车尺寸、熊妈妈的汽车尺寸和小熊的汽车尺寸。

如果存在多种可能的解,输出任意一个即可。

如果无解,则输出 \-1(不带引号)。

输入输出样例

  • 输入#1

    50 30 10 10

    输出#1

    50
    30
    10
  • 输入#2

    100 50 10 21

    输出#2

    -1

说明/提示

In first test case all conditions for cars' sizes are satisfied.

In second test case there is no answer, because Masha should be able to climb into smallest car (so size of smallest car in not less than 21), but son bear should like it, so maximum possible size of it is 20.

在第一个测试用例中,所有关于汽车尺寸的条件均被满足。

在第二个测试用例中无解,因为玛莎必须能够进入最小的汽车(因此最小汽车的尺寸不小于 21),但小熊儿子却必须喜欢它,故其最大可能尺寸为 20。

输入解题思路,AI测评打分。不知道怎么写?

首页