这题各种TL,各种wa,且看大犇解析
非常牛逼的将O(n^2)降到O(n)
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int oo=0x3f3f3f3f;
const ll OO=1LL<<61;
const int Mod=1000000007;
const int maxn=100000+100;
ll dp[maxn];
int v[maxn];
int c[maxn];
struct DP
{
ll max1,max2;
int maxc1,maxc2;
void Clear()
{
maxc1=maxc2=-1;
max1=max2=-OO;
}
ll get_max(int c)
{
if(c!=maxc1) return max1;