CF12D.Ball

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

NN ladies attend the ball in the King's palace. Every lady can be described with three values: beauty, intellect and richness. King's Master of Ceremonies knows that ladies are very special creatures. If some lady understands that there is other lady at the ball which is more beautiful, smarter and more rich, she can jump out of the window. He knows values of all ladies and wants to find out how many probable self-murderers will be on the ball. Lets denote beauty of the ii -th lady by BiB_{i} , her intellect by IiI_{i} and her richness by RiR_{i} . Then ii -th lady is a probable self-murderer if there is some jj -th lady that Bi<Bj,Ii<Ij,Ri<RjB_{i}<B_{j},I_{i}<I_{j},R_{i}<R_{j} . Find the number of probable self-murderers.

输入格式

The first line contains one integer NN ( 1<=N<=5000001<=N<=500000 ). The second line contains NN integer numbers BiB_{i} , separated by single spaces. The third and the fourth lines contain sequences IiI_{i} and RiR_{i} in the same format. It is guaranteed that 0<=Bi,Ii,Ri<=1090<=B_{i},I_{i},R_{i}<=10^{9} .

输出格式

Output the answer to the problem.

输入输出样例

  • 输入#1

    3
    1 4 2
    4 3 2
    2 5 3
    

    输出#1

    1
    
首页