#P3256. [JLOI2013] 赛车
[JLOI2013] 赛车
Description
There is a car race underway. There are cars on the track, named . The track is an infinitely long straight line. Initially, is located units before the starting line. After the race starts, car travels at a constant speed of units per second. During the race, if a car has ever been in the lead (i.e., no other car is ahead of it), that car will win in the end, and collisions are not a concern. Given all cars’ starting positions and speeds, determine which cars will win.
Input Format
The first line contains a positive integer , the number of cars. The next line contains integers, giving the starting positions of the cars in order. The following line contains integers, giving the constant speeds of the cars in order.
Output Format
Output two lines. The first line contains the number of winning cars. The second line contains the indices of the winning cars in increasing order, separated by spaces, with no trailing space.
4
1 1 0 0
15 16 10 20
3
1 2 4
Hint
Constraints
- For 100% of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号