Star Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 516 Accepted Submission(s): 213 Problem Description One of Resty's interests is to watch stars. The Stars are so beautiful! Lyra's Vega, A…
一道很经典的题 这道题就是要求一个最长单调不升子序列和一个最长单调上升子序列. 先打了一个n2复杂度的 用DP #include<bits/stdc++.h> using namespace std; #define N 10005 int f[N],a[N]; int n; int cnt1,cnt2,tot; int main() { while(scanf("%d",&a[++n])!=EOF); n--; // cout<<n<<en…
单调队列存坐标 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define R(a,b,c) for(register int a = (b); a <= (c); ++ a) #define nR(a,b,c) for(register int a = (b); a >= (c); --…
Description Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't e…