三维偏序 就是让第一维有序 然后归并+树状数组求两维 cdq+cdq不会 告辞 #include <bits/stdc++.h> // #define int long long #define rep(a , b , c) for(int a = b ; a <= c ; ++ a) #define Rep(a , b , c) for(int a = b ; a >= c ; -- a) #define go(u) for(int i = G.head[u] , v = G.t…
COGS2479:四维偏序. CDQ套CDQ CDQ:对a分治,对b排序,再对a打标记,然后执行CDQ2 CDQ2:对b分治,对c归并排序,对d树状数组. #include<cstdio> #include<algorithm> #define rep(i,l,r) for (int i=l; i<=r; i++) using namespace std; typedef long long ll; ; int n,ans,c[N]; struct P{ int a,b,c,…
一个下午的光阴之死,凶手是细节与手残. 致命的一枪:BIT存权值时: for(; x <= maxx; x += x&-x) t[x] += w; //for(; x <= n; x += x&-x) t[x] += w;// You died int n; int maxx; struct Element{ int a,b,c; long long ans; int siz; bool operator< (const Element &com)const{ i…
Another Longest Increasing Subsequence Problem Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=19929 Description Given a sequence of N pairs of integers, find the length of the longest incre…
Jam's problem again Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 640 Accepted Submission(s): 210 Problem Description Jam like to solve the problem which on the 3D-axis,given N(1≤N≤100000)…