#P3256. [JLOI2013] 赛车

    ID: 2305 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2013吉林枚举,暴力半平面交

[JLOI2013] 赛车

Description

There is a car race underway. There are nn cars on the track, named g1,g2,...,gng_1,g_2,...,g_n. The track is an infinitely long straight line. Initially, gig_i is located kik_i units before the starting line. After the race starts, car gig_i travels at a constant speed of viv_i 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 nn, the number of cars. The next line contains nn integers, giving the starting positions kik_i of the nn cars in order. The following line contains nn integers, giving the constant speeds viv_i of the nn 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, 1n1041 \le n \le 10^4, 0ki1090 \le k_i \le 10^9, 0vi1090 \le v_i \le 10^9.

Translated by ChatGPT 5