ABBYY Cup 3.0 - Finals (online version)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
331 ABBYY Cup 3.0 - Finals (online version) FINISHED False 8100 402330623 July 17, 2013, 3:30 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 202 ) D3 Escaping on Beaveractor PROGRAMMING data structures implementation trees 2900

Don't put up with what you're sick of! The Smart Beaver decided to escape from the campus of Beaver Science Academy (BSA). BSA is a b × b square on a plane. Each point x , y (0 ≤ x , y ≤ b ) belongs to BSA. To make the path quick and funny, the Beaver constructed a Beaveractor, an effective and comfortable types of transport. The campus obeys traffic rules: there are n arrows, parallel to the coordinate axes. The arrows do not intersect and do not touch each other. When the Beaveractor reaches some arrow, it turns in the arrow's direction and moves on until it either reaches the next arrow or gets outside the campus. The Beaveractor covers exactly one unit of space per one unit of time. You can assume that there are no obstacles to the Beaveractor. The BSA scientists want to transport the brand new Beaveractor to the "Academic Tractor" research institute and send the Smart Beaver to do his postgraduate studies and sharpen pencils. They have q plans, representing the Beaveractor's initial position ( x i , y i ) , the initial motion vector w i and the time t i that have passed after the escape started. Your task is for each of the q plans to determine the Smart Beaver's position after the given time. The first line contains two integers: the number of traffic rules n and the size of the campus b , 0 ≤ n , 1 ≤ b . Next n lines contain the rules. Each line of the rules contains four space-separated integers x 0 , y 0 , x 1 , y 1 — the beginning and the end of the arrow. It is guaranteed that all arrows are parallel to the coordinate axes and have no common points. All arrows are located inside the campus, that is, 0 ≤ x 0 , y 0 , x 1 , y 1 ≤ b holds. Next line contains integer q — the number of plans the scientists have, 1 ≤ q ≤ 10 5 . The i -th plan is represented by two integers, x i , y i are the Beaveractor's coordinates at the initial time, 0 ≤ x i , y i ≤ b , character w i , that takes value U , D , L , R and sets the initial direction up, down, to the l

Tutorials

ABBYY Cup 3.0 — Finals. Solutions

Submissions

No solutions yet.