assume you provide three orders to the robot: at time 1 maneuver to point 5, at time 3 move to point 0 and at time 6 move to point 4. Then, at that point, the robot remains at 0 until time 1, then, at that point, begins moving towards 5, overlooks the subsequent order, arrives at 5 at time 6 and quickly begins moving to 4 to execute the third order. At time 7 it arrives at 4 and stops there.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

assume you provide three orders to the robot: at time 1 maneuver to point 5, at time 3 move to point 0 and at time 6 move to point 4. Then, at that point, the robot remains at 0 until time 1, then, at that point, begins moving towards 5, overlooks the subsequent order, arrives at 5 at time 6 and quickly begins moving to 4 to execute the third order. At time 7 it arrives at 4 and stops there. 

 

You call the order I fruitful, in case there is a period second in the reach [ti,ti+1] (I. e. after you provide this order and before you give another, the two limits comprehensive; we consider tn+1=+∞) when the robot is at point xi. Count the number of fruitful orders. Note that it is conceivable that a disregarded order is fruitful. 

 

Input 

 

The principal line contains a solitary integer t (1≤t≤1000) — the number of experiments. The following lines depict the experiments. 

 

The principal line of an experiment contains a solitary integer n (1≤n≤105) — the number of orders. 

 

The following n lines depict the orders. The I-th of these lines contains two integers ti and xi (1≤ti≤109, −109≤xi≤109) — the time and the place of the I-th order. 

 

The orders are requested by time, that is, ti<ti+1 for all conceivable I. 

 

The amount of n over experiments doesn't surpass 105. 

 

Output 

 

For each testcase output a solitary integer — the number of fruitful orders.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Development strategies
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education