题意:
给一个长度为n的序列,你的任务是删除一个连续子序列,使得剩下序列中有一个长度最大的连续递增子序列。
详细在代码里。
g数组表示的是以i为后缀的最长上升序列的长度
f数组表示的是以i为前缀的最长上升序列的长度
维护的set
在维护的过程中可以保证二元的 i < j && a[i] < a[j] && g[i] < g[j]
代码:
#include<bits/stdc++.h>
#define LL long long
#define ms(s) memset(s, 0, sizeof(s))
#define INF 0x7fffffff
using namespace std;
const int maxn = 2e5 + 10;
int arr[maxn];
int g[maxn]; //which means most length end with i
int f[maxn]; //which means most length begin with i
struct Node {
int a, g; //a means a[i] g means most length end with i
Node(int a, int g): a(a), g(g) {
}
friend bool operator < (const Node& n1, const Node& n2) {
return