codeforces-scrape

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

215B.md (2580B)


      1 Source: https://codeforces.com/problemset/problem/215/B
      2 
      3 B. Olympic Medal
      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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of *r*1 cm, inner radius of *r*2 cm, (0 < *r*2 < *r*1) made of metal with density *p*1 g/cm3. The second part is an inner disk with radius *r*2 cm, it is made of metal with density *p*2 g/cm3. The disk is nested inside the ring.
     22 
     23 The Olympic jury decided that *r*1 will take one of possible values of *x*1, *x*2, ..., *x**n*. It is up to jury to decide which particular value *r*1 will take. Similarly, the Olympic jury decided that *p*1 will take one of possible value of *y*1, *y*2, ..., *y**m*, and *p*2 will take a value from list *z*1, *z*2, ..., *z**k*.
     24 
     25 According to most ancient traditions the ratio between the outer ring mass *m**out* and the inner disk mass *m**in* must equal ![](https://espresso.codeforces.com/bfd66f1a72c32e8dc2ae817f13f33e8967bc2348.png), where *A*, *B* are constants taken from ancient books. Now, to start making medals, the jury needs to take values for *r*1, *p*1, *p*2 and calculate the suitable value of *r*2.
     26 
     27 The jury wants to choose the value that would maximize radius *r*2. Help the jury find the sought value of *r*2. Value *r*2 doesn't have to be an integer.
     28 
     29 Medal has a uniform thickness throughout the area, the thickness of the inner disk is the same as the thickness of the outer ring.
     30 
     31 Input
     32 
     33 The first input line contains an integer *n* and a sequence of integers *x*1, *x*2, ..., *x**n*. The second input line contains an integer *m* and a sequence of integers *y*1, *y*2, ..., *y**m*. The third input line contains an integer *k* and a sequence of integers *z*1, *z*2, ..., *z**k*. The last line contains two integers *A* and *B*.
     34 
     35 All numbers given in the input are positive and do not exceed 5000. Each of the three sequences contains distinct numbers. The numbers in the lines are separated by spaces.
     36 
     37 Output
     38 
     39 Print a single real number — the sought value *r*2 with absolute or relative error of at most 10- 6. It is guaranteed that the solution that meets the problem requirements exists.
     40 
     41 Examples
     42 
     43 Input
     44 
     45 ```
     46 3 1 2 3  
     47 1 2  
     48 3 3 2 1  
     49 1 2
     50 ```
     51 
     52 Output
     53 
     54 ```
     55 2.683281573000
     56 ```
     57 
     58 Input
     59 
     60 ```
     61 4 2 3 6 4  
     62 2 1 2  
     63 3 10 6 8  
     64 2 1
     65 ```
     66 
     67 Output
     68 
     69 ```
     70 2.267786838055
     71 ```
     72 
     73 Note
     74 
     75 In the first sample the jury should choose the following values: *r*1 = 3, *p*1 = 2, *p*2 = 1.