F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Server

Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 1860    Accepted Submission(s): 325


Problem Description
Alice and Bob are working on a new assignment. In this project, they need to access some information on a website and monitor this web site for consistent $t$ days. In others words, in each day, there must be at least one server in work. Luckily, they can rent some servers in the lab. According to the schedule, there are totally $N$ servers being available. The $i$-th server can be used from the $S_i$-th day to the $T_i$-th day. However, using the $i$-th server require $A_i$ dollars. After a long time of persuasion, the administrator of the machine room agree to give Alice and Bob discount. Each server is assigned with a discount number $B_i$. If the set of servers they want to use is $S$, they need to pay $\frac{\sum_{i\in S}A_i}{\sum_{i\in S}B_i}$ dollars. As Alice and Bob are preparing the programs on the servers, they want your help to find a way to minimize the cost of servers.
 

Input
The first line is the number of test cases. For each test case, the first contains two positive integers $N$ and $t$ $(N \leq 100000, t \leq 100000)$ as described above. In the next $N$ lines, the $i$-th line consists of four integer $S_i$, $T_i$, $A_i$, and $B_i$ $(1 \leq S_i \leq T_i \leq t, 0 < A_i, B_i \leq 1000)$.
 

Output
For each test case, output an float-point number with three decimal places donating the minimum cost Alice and Bob need to pay. It is guaranteed that there is at least one feasible way to rent servers.
 

Sample Input
1 4 5 1 3 28 1 4 5 22 1 3 5 34 1 1 2 26 1
 

Sample Output
25.000
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 21:47:02, Gzip enabled