CF76B.Mice

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Modern researches has shown that a flock of hungry mice searching for a piece of cheese acts as follows: if there are several pieces of cheese then each mouse chooses the closest one. After that all mice start moving towards the chosen piece of cheese. When a mouse or several mice achieve the destination point and there is still a piece of cheese in it, they eat it and become well-fed. Each mice that reaches this point after that remains hungry. Moving speeds of all mice are equal.

If there are several ways to choose closest pieces then mice will choose it in a way that would minimize the number of hungry mice. To check this theory scientists decided to conduct an experiment. They located NN mice and MM pieces of cheese on a cartesian plane where all mice are located on the line y=Y0y=Y_{0} and all pieces of cheese — on another line y=Y1y=Y_{1} . To check the results of the experiment the scientists need a program which simulates the behavior of a flock of hungry mice.

Write a program that computes the minimal number of mice which will remain hungry, i.e. without cheese.

输入格式

The first line of the input contains four integer numbers NN ( 1<=N<=1051<=N<=10^{5} ), MM ( 0<=M<=1050<=M<=10^{5} ), Y0Y_{0} ( 0<=Y0<=1070<=Y_{0}<=10^{7} ), Y1Y_{1} ( 0<=Y1<=1070<=Y_{1}<=10^{7} , Y0Y1Y_{0}≠Y_{1} ). The second line contains a strictly increasing sequence of NN numbers — xx coordinates of mice. Third line contains a strictly increasing sequence of MM numbers — xx coordinates of cheese. All coordinates are integers and do not exceed 10710^{7} by absolute value.

输出格式

The only line of output should contain one number — the minimal number of mice which will remain without cheese.

输入输出样例

  • 输入#1

    3 2 0 2
    0 1 3
    2 5
    

    输出#1

    1
    

说明/提示

All the three mice will choose the first piece of cheese. Second and third mice will eat this piece. The first one will remain hungry, because it was running towards the same piece, but it was late. The second piece of cheese will remain uneaten.

首页