题目大意
略...
(吐槽这题面...让我毫无阅读兴趣)
题解
首先要求出在以两条斜线为新坐标轴下,每个点的坐标
那么....按x先排序
再求y的最长上升子序列
复杂度O(nlogn)吧
记得开longlong
#include<cstdio> #include<algorithm> #include<cstring> #define ll long long using namespace std; inline ll read() { ll sum = 0,p = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-') p = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { (sum *= 10) += ch - '0'; ch = getchar(); } return sum * p; } const int maxn = 100005; ll n,a,b,c,d,f[maxn]; struct pot { ll x,y; }p[maxn]; bool cmp(pot a,pot b){return a.x < b.x;} ll lis() { ll len = 0; for(int i = 1;i <= n;i++) if(p[i].x > 0 && p[i].y > 0) { if(p[i].y > f[len]) f[++len] = p[i].y; else if(p[i].y< f[1]) f[1] = p[i].y; else f[lower_bound(f + 1,f + len + 1,p[i].y) - f] = p[i].y; } return len; } int main() { n = read(); a = read(),b = read(),c = read(),d = read(); for(int i = 1;i <= n;i++) { int x = read(),y = read(); p[i].x = c * x - d * y; p[i].y = b * y - a * x; } sort(p+1,p + n + 1,cmp); printf("%lld",lis()); return 0; }