{"problem":{"name":"B. Three-level Laser","description":{"content":"An atom of element X can exist in _n_ distinct states with energies _E_1 < _E_2 < ... < _E__n_. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified descript","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF956B"},"statements":[{"statement_type":"Markdown","content":"An atom of element X can exist in _n_ distinct states with energies _E_1 < _E_2 < ... < _E__n_. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme.\n\nThree distinct states _i_, _j_ and _k_ are selected, where _i_ < _j_ < _k_. After that the following process happens:\n\n1.  initially the atom is in the state _i_,\n2.  we spend _E__k_ - _E__i_ energy to put the atom in the state _k_,\n3.  the atom emits a photon with useful energy _E__k_ - _E__j_ and changes its state to the state _j_,\n4.  the atom spontaneously changes its state to the state _i_, losing energy _E__j_ - _E__i_,\n5.  the process repeats from step 1.\n\nLet's define the energy conversion efficiency as , i. e. the ration between the useful energy of the photon and spent energy.\n\nDue to some limitations, Arkady can only choose such three states that _E__k_ - _E__i_ ≤ _U_.\n\nHelp Arkady to find such the maximum possible energy conversion efficiency within the above constraints.\n\n## Input\n\nThe first line contains two integers _n_ and _U_ (3 ≤ _n_ ≤ 105, 1 ≤ _U_ ≤ 109) — the number of states and the maximum possible difference between _E__k_ and _E__i_.\n\nThe second line contains a sequence of integers _E_1, _E_2, ..., _E__n_ (1 ≤ _E_1 < _E_2... < _E__n_ ≤ 109). It is guaranteed that all _E__i_ are given in increasing order.\n\n## Output\n\nIf it is not possible to choose three states that satisfy all constraints, print _\\-1_.\n\nOtherwise, print one real number η — the maximum possible energy conversion efficiency. Your answer is considered correct its absolute or relative error does not exceed 10 - 9.\n\nFormally, let your answer be _a_, and the jury's answer be _b_. Your answer is considered correct if .\n\n[samples]\n\n## Note\n\nIn the first example choose states 1, 2 and 3, so that the energy conversion efficiency becomes equal to .\n\nIn the second example choose states 4, 5 and 9, so that the energy conversion efficiency becomes equal to .","is_translate":false,"language":"English"}],"meta":{"iden":"CF956B","tags":["binary search","greedy","two pointers"],"sample_group":[["4 4\n1 3 5 7","0.5"],["10 8\n10 13 15 16 17 19 20 22 24 25","0.875"],["3 1\n2 5 10","\\-1"]],"created_at":"2026-03-03 11:00:39"}}