PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BF0000046. Người đo hệ số chênh lệch (Double-Kill Meter)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Người đo hệ số chênh lệch (Double-Kill Meter)
Double-Kill Meter
Source: Luogu
Version: Phuoc Hung OJ Extended
Problem Statement
Every participant has a positive real score. Each pledge is 1 A B k or 2 A B k. Under relaxation , avoiding all pledge penalties requires for type 1, and for type 2. Some scores are fixed. Find the largest for which every score assignment violates a pledge; print -1 if none exists.
Input
First line ; then lines ; then fixed scores .
Output
Print -1 or a real number with absolute error at most .
Subtasks
- Subtask 1 (20 points): , , ; ; ; , ; fixed-score indices are distinct.
- Subtask 2 (30 points): , , ; ; ; , ; fixed-score indices are distinct.
- Subtask 3 (50 points): , ; ; ; , ; fixed-score indices are distinct.
Examples
Input
2 2 2
1 1 2 2
1 2 1 2
1 1
2 1
Output
1.0000000
Explanation
Both known scores are . Avoiding either type-1 penalty requires , equivalently . For every a penalty is unavoidable; for all pledges can hold. The threshold is .