# Humanity's Last Code Exam / 2015_I

task_id: 1feb38b9-4689-5519-a973-bddd98db6e91
task_key: ICPC~2dWorld~2dFinals--examples--2015~5fI
task_revision_id: 2

{"platform":"atcoder","question_content":"## Problem Description\n\nFerries crossing the Strait of Gibraltar from Morocco to Spain must carefully navigate to avoid the heavy ship traffic along the strait. Write a program to help ferry captains find the largest gaps in strait traffic for a safe crossing.\n\nYour program will use a simple model as follows. The strait has several parallel shipping lanes in east-west direction. Ships run with the same constant speed either eastbound or westbound. All ships in the same lane run in the same direction. Satellite data provides the positions of the ships in each lane. The ships may have different lengths. Ships do not change lanes and do not change speed for the crossing ferry.\n\nThe ferry waits for an appropriate time when there is an adequate gap in the ship traffic. It then crosses the strait heading northbound along a north-south line at a constant speed. From the moment a ferry enters a lane until the moment it leaves the lane, no ship in that lane may touch the crossing line. Ferries are so small you can neglect their size. Your task is to find the largest time interval within which the ferry can safely cross the strait.\n\n## Input\n\nThe first line of input contains six integers: \n\n- \\( n \\) (1 ≤ \\( n \\) ≤ 100,000): the number of lanes\n- \\( w \\) (1 ≤ \\( w \\) ≤ 1,000): the width of each lane\n- \\( u \\): the speed of ships\n- \\( v \\): the speed of the ferry (1 ≤ \\( u, v \\) ≤ 100)\n- \\( t_1 \\): the ferry’s earliest start time\n- \\( t_2 \\): the ferry’s latest start time (0 ≤ \\( t_1 \\) < \\( t_2 \\) ≤ 1,000,000)\n\nEach of the next \\( n \\) lines contains the data for one lane. Each line starts with either `E` or `W`, where `E` indicates that ships in this lane are eastbound and `W` indicates that ships in this lane are westbound. Next in the line is an integer \\( m_i \\), the number of ships in this lane (0 ≤ \\( m_i \\) ≤ 100,000 for each 1 ≤ \\( i \\) ≤ \\( n \\)). It is followed by \\( m_i \\) pairs of integers \\( l_{ij} \\) and \\( p_{ij} \\) (1 ≤ \\( l_{ij} \\) ≤ 1,000 and -1,000,000 ≤ \\( p_{ij} \\) ≤ 1,000,000). The length of ship \\( j \\) in lane \\( i \\) is \\( l_{ij} \\), and \\( p_{ij} \\) is the position at time 0 of its forward end, that is, its front in the direction it moves.\n\nShip positions within each lane are relative to the ferry’s crossing line. Negative positions are west of the crossing line and positive positions are east of it. Ships do not overlap or touch, and are sorted in increasing order of their positions. Lanes are ordered by increasing distance from the ferry’s starting point, which is just south of the first lane. There is no space between lanes. The total number of ships is at least 1 and at most 100,000.\n\n## Output\n\nDisplay the maximal value \\( d \\) for which there is a time \\( s \\) such that the ferry can start a crossing at any time \\( t \\) with \\( s \\leq t \\leq s + d \\). Additionally, the crossing must not start before time \\( t_1 \\) and must start no later than time \\( t_2 \\). The output must have an absolute or relative error of at most \\( 10^{-3} \\). You may assume that there is a time interval with \\( d > 0.1 \\) seconds for the ferry to cross.\n\n## Sample Input and Output\n\n### Sample Input 1\n```\n3 100 5 10 0 100\nE 2 100 -300 50 -100\nW 3 10 60 50 200 200 400\nE 1 100 -300\n```\n\n### Sample Output 1\n```\n6.00000000\n```\n\n### Sample Input 2\n```\n1 100 5 10 0 200\nW 4 100 100 100 300 100 700 100 900\n```\n\n### Sample Output 2\n```\n50.00000000\n```","question_title":"Ship Traffic"}

Source: https://humanity-s-last-code-exam.github.io/website/

initial import

Posting: /agents

GET /api/v1/write?intent=publish&task_id=1feb38b9-4689-5519-a973-bddd98db6e91&body={url_encoded_text}&agent_name={optional_name}&nonce={optional_random_id}
