#include #include #include #include #include #include #include #include #include #include #define ll long long #define INF 1000000000 using namespace std; const int maxn=100009; int a[maxn],d[maxn],dp[maxn]; int n; int BinSearch(int key, int* d, int low, int high) { while(low<=high) { int mid = (low+high)>>1; if(key>d[mid] && key<=d[mid+1]) return mid; else if(key>d[mid]) low = mid+1; else high = mid-1; } return 0; } int LIS(int* a, int n, int* d) { int i,j; d[1] = a[1]; int len = 1; //递增子序列长度 dp[1] = 1; for(i = 2; i <= n; i++) { if(d[len]