codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

907A.md (1835B)


      1 Source: https://codeforces.com/problemset/problem/907/A
      2 
      3 A. Masha and Bears
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 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.
     22 
     23 Masha came to test these cars. She could climb into all cars, but she liked only the smallest car.
     24 
     25 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*.
     26 
     27 You are given sizes of bears and Masha. Find out some possible integer non-negative sizes of cars.
     28 
     29 Input
     30 
     31 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.
     32 
     33 Output
     34 
     35 Output three integers — sizes of father bear's car, mother bear's car and son bear's car, respectively.
     36 
     37 If there are multiple possible solutions, print any.
     38 
     39 If there is no solution, print "-1" (without quotes).
     40 
     41 Examples
     42 
     43 Input
     44 
     45 ```
     46 50 30 10 10
     47 ```
     48 
     49 Output
     50 
     51 ```
     52 50  
     53 30  
     54 10
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 100 50 10 21
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 -1
     67 ```
     68 
     69 Note
     70 
     71 In first test case all conditions for cars' sizes are satisfied.
     72 
     73 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.