BZOJ 3262 陌上花開 「樹套樹」

2021-07-08 08:56:26 字數 1250 閱讀 1212

三維空間內求每個點比它3維都要大的點的個數。

第1維排序,第2維樹狀陣列,第3維treap。

好像第1維排序就叫做降維了?

神tm吧乙個陣列開錯大小老wa。。。

cdq分治好像挺好寫

#include #include using namespace std;

int read()

const int n = 100005, m = 5000005;

int n, m, id;

int root[n * 2], ans[n], sum[n];

int s[m], l[m], r[m], v[m], w[m], rnk[m];

struct flower {

int a, b, c;

friend bool operator < (const flower &a, const flower &b) {

return (a.a==b.a)?((a.b==b.b)?(a.c

time limit: 20 sec  

memory limit: 256 mb

submit: 544  

solved: 243 [

submit][

status][

discuss]

有n朵花,每朵花有三個屬性:花形(s)、顏色(c)、氣味(m),又三個整數表示。現要對每朵花評級,一朵花的級別是它擁有的美麗能超過的花的數量。定義一朵花a比另一朵花b要美麗,當且僅當sa>=sb,ca>=cb,ma>=mb。顯然,兩朵花可能有同樣的屬性。需要統計出評出每個等級的花的數量。

第一行為n,k (1 <= n <= 100,000, 1 <= k <= 200,000 ), 分別表示花的數量和最大屬性值。

以下n行,每行三個整數si, ci, mi (1 <= si, ci, mi <= k),表示第i朵花的屬性

包含n行,分別表示評級為0...n-1的每級花的數量。

10 3

3 3 3

2 3 3

2 3 1

3 1 1

3 1 2

1 3 1

1 1 2

1 2 2

1 3 2

1 2 131

3010

1001

1 <= n <= 100,000, 1 <= k <= 200,000

BZOJ 3262 陌上花開 樹套樹

蒟蒻不會什麼cdq分治,treap套樹狀陣列寫好。看來還是有必要學一下cdq分治,逼近總不能每次拿著平衡樹亂套啊!這道題大致思路就是排序 樹狀陣列 treap,明了!include include include include include using namespace std const i...

bzoj3262 陌上花開 樹套樹

1 include 2 include 3 include 4 include 5 include 6 define maxn 100005 7 define maxm 200005 8 define maxk 2000005 9using namespace std 1011 int n,k,te...

BZOJ3262 陌上花開

description 有n朵花,每朵花有三個屬性 花形 s 顏色 c 氣味 m 又三個整數表示。現要對每朵花評級,一朵花的級別是它擁有的美麗能超過的花的數量。定義一朵花a比另一朵花b要美麗,當且僅當sa sb,ca cb,ma mb。顯然,兩朵花可能有同樣的屬性。需要統計出評出每個等級的花的數量。...