P3810 【模板】三维偏序(陌上花开)
题面 https://www.luogu.org/problem/P3810 题解 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; struct node { int s1,s2,s3; bool operator < (const node rhs) const { return s1<rhs.s1 || s1==rhs.s1 && s2<rhs.s2 || s1==rhs.s1 && s2==rhs.s2 && s3<rhs.s3; } } a[100050]; struct newnode { int s1,s2,s3; int f,v; bool operator < (const newnode rhs) const { return s2<rhs.s2; } } b[100050]; int n,k,newn; int ans[100050]; struct fenwick { long long tree[200050]={0}; void insert(int loc,int v) { for (int i=loc;i<=k;i+=i&-i) tree[i]+=v; } int query(int loc) { long long sum=0; for (int