304275: CF815D. Karen and Cards
Memory Limit:512 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Karen and Cards
题意翻译
给n个三元组,再构造一个三元组(a,b,c),a<=p,b<=q,c<=r 求有多少个满足,a,b,c中至少两个大于每一个a[i],b[i],c[i]题目描述
Karen just got home from the supermarket, and is getting ready to go to sleep. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF815D/d6b07c74db93ed793c45ff910937379fe578d8dc.png)After taking a shower and changing into her pajamas, she looked at her shelf and saw an album. Curious, she opened it and saw a trading card collection. She recalled that she used to play with those cards as a child, and, although she is now grown-up, she still wonders a few things about it. Each card has three characteristics: strength, defense and speed. The values of all characteristics of all cards are positive integers. The maximum possible strength any card can have is $ p $ , the maximum possible defense is $ q $ and the maximum possible speed is $ r $ . There are $ n $ cards in her collection. The $ i $ -th card has a strength $ a_{i} $ , defense $ b_{i} $ and speed $ c_{i} $ , respectively. A card beats another card if at least two of its characteristics are strictly greater than the corresponding characteristics of the other card. She now wonders how many different cards can beat all the cards in her collection. Two cards are considered different if at least one of their characteristics have different values.输入输出格式
输入格式
The first line of input contains four integers, $ n $ , $ p $ , $ q $ and $ r $ ( $ 1<=n,p,q,r<=500000 $ ), the number of cards in the collection, the maximum possible strength, the maximum possible defense, and the maximum possible speed, respectively. The next $ n $ lines each contain three integers. In particular, the $ i $ -th line contains $ a_{i} $ , $ b_{i} $ and $ c_{i} $ ( $ 1<=a_{i}<=p $ , $ 1<=b_{i}<=q $ , $ 1<=c_{i}<=r $ ), the strength, defense and speed of the $ i $ -th collection card, respectively.
输出格式
Output a single integer on a line by itself, the number of different cards that can beat all the cards in her collection.
输入输出样例
输入样例 #1
3 4 4 5
2 2 5
1 3 4
4 1 1
输出样例 #1
10
输入样例 #2
5 10 10 10
1 1 1
1 1 1
1 1 1
1 1 1
1 1 1
输出样例 #2
972