CF12D.Ball

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

N 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 i-th lady by B__i, her intellect by I__i and her richness by R__i. Then i-th lady is a probable self-murderer if there is some j-th lady that B__i < B__j, I__i < I__j, R__i < R__j. Find the number of probable self-murderers.

有 NN 位女士参加国王宫殿举办的舞会。每位女士可用三个数值来描述:美貌值、智力值和财富值。国王的司仪深知女士们是非常特别的生物:如果某位女士意识到舞会上存在另一位女士,其美貌值、智力值和财富值均高于自己,她就可能会跳窗自杀。司仪知晓所有女士的各项数值,他希望计算出舞会上可能自杀的女士人数。设第 ii 位女士的美貌值为 BiB_i,智力值为 IiI_i,财富值为 RiR_i。那么,若存在某位第 jj 位女士,使得 Bi<BjB_i < B_j、Ii<IjI_i < I_j 且 Ri<RjR_i < R_j,则第 ii 位女士即为一位可能的自杀者。请计算可能自杀的女士人数。

输入格式

The first line contains one integer N (1 ≤ N ≤ 500000). The second line contains N integer numbers B__i, separated by single spaces. The third and the fourth lines contain sequences I__i and R__i in the same format. It is guaranteed that 0 ≤ B__i, I__i, R__i ≤ 109.

第一行包含一个整数 NN(1≤N≤5000001 \leq N \leq 500000)。第二行包含 NN 个整数 BiB_i,以单个空格分隔。第三行和第四行以相同格式分别给出序列 IiI_i 和 RiR_i。保证 0≤Bi, Ii, Ri≤1090 \leq B_i,\, I_i,\, R_i \leq 10^9。

输出格式

Output the answer to the problem.

输出问题的答案。

输入输出样例

  • 输入#1

    3
    1 4 2
    4 3 2
    2 5 3

    输出#1

    1

输入解题思路,AI测评打分。不知道怎么写?

首页