# 洛谷3628 APIO2010特别行动队（斜率优化）

$dp[i]=max(dp[j]+a*(sum[i]-sum[j])^2+b*(sum[i]-sum[j])+c$

qwq

qwq

$$f[x]=dp[x]+a*sum[x]^2$$

$\frac{f[j]-f[k]}{s[j]-s[k]}>2*a*sum[i]+b$

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#define mk make_pair
#define ll long long
#define int long long
using namespace std;
{
int x=0,f=1;char ch=getchar();
while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
while (isdigit(ch)) {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
return x*f;
}
const int maxn = 2e6+1e2;
struct Point{
int x,y,num;
};
Point q[maxn];
int n,m;
int sum[maxn];
int val[maxn];
int a,b,c;
int dp[maxn];
int chacheng(Point x,Point y)
{
return x.x*y.y-x.y*y.x;
}
bool count(Point i,Point j,Point k)
{
Point x,y;
x.x=k.x-i.x;
x.y=k.y-i.y;
y.x=k.x-j.x;
y.y=k.y-j.y;
if(chacheng(x,y)>=0) return true;
return false;
}
void push(Point x)
{
q[++tail]=x;
}
void pop(int lim)
{
}
signed main()
{
for (int i=1;i<=n;i++) sum[i]=sum[i-1]+val[i];
push((Point){0,0,0});
for (int i=1;i<=n;i++)
{
pop(2*a*sum[i]+b);