LearnPy Hub
← Arena
IntermediateRating 1400

Car Fleets

Cars drive toward a target along one road. A car that catches up with a slower car ahead drives with it from then on as one fleet (cars meeting exactly at the target also count as one fleet). How many fleets arrive?

Input

n and target; then n lines 'position speed' (positions are different and below target).

Output

One integer.

Sample 1

Input
5 12
10 2
8 4
0 1
5 1
3 3
Output
3

Sample 2

Input
1 10
3 3
Output
1
solution.py
Output appears here
Car Fleets · Python Arena problem · LearnPy Hub