A11553 | Masha and Bears
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $2a>=b$ .
You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.
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 $2a>=b$ .
You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.
输入格式
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}$ .
输出格式
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).
If there are multiple possible solutions, print any.
If there is no solution, print "-1" (without quotes).
输入输出样例
输入 #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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted