前言
前几天题目没改完(好难QvQQvQQvQ),然后这几天ZZYZZYZZY和WHFWHFWHF去广州二中了
然后我是菜鸡,今天暴力写挂了QAQQAQQAQ,T2T2T2少判断了个东西少了808080
成绩
懒得写只放自己的了(反正垫底)
Rank51,20ptsRank51,20ptsRank51,20pts
正题
T1:jzoj6290−T1:jzoj6290-T1:jzoj6290−倾斜的线【计算几何,,,贪心】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/99693969
T2:jzoj6305−T2:jzoj6305-T2:jzoj6305−最小值【线段树,dp,,dp,,dp,双端链表】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/99694337
T3:jzoj6307−T3:jzoj6307-T3:jzoj6307−安排【归并排序】
链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/99697273
总结
一看T1T1T1不会,不过暴力挺简单,T2T2T2一看就是dpdpdp,T3T3T3又是老虎直接跳过。
然后写T2T2T2发现线段树贼简单然后就写完了,然后T1T1T1很快就敲完了暴力。
结果发现T2T2T2没有判头是负数是202020,T1T1T1分数比较写挂了没分
SomeofcodeSome\ of\ codeSome of code
T220ptscodeT2\ 20pts\ codeT2 20pts code
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const ll N=2e5+100,inf=1e18;
struct Tree_node{ll w,lazy;
};
struct Seq_node{Tree_node t[N*4]; void Build(ll x,ll l,ll r){if(l==r){t[x].w=0;t[x].lazy=-inf;return;}ll mid=(l+r)/2;Build(x*2,l,mid);Build(x*2+1,mid+1,r);}void downdata(ll x){if(t[x].lazy==-inf) return;t[x*2].w=t[x*2+1].w=t[x*2].lazy=t[x*2+1].lazy=t[x].lazy; t[x].lazy=-inf;}void Change(ll x,ll l,ll r,ll w,ll L,ll R){if(l==L&&r==R){t[x].w=w;t[x].lazy=w;return;}downdata(x);ll mid=(L+R)/2;if(r<=mid) Change(x*2,l,r,w,L,mid);else if(l>mid) Change(x*2+1,l,r,w,mid+1,R);else Change(x*2,l,mid,w,L,mid),Change(x*2+1,mid+1,r,w,mid+1,R);t[x].w=max(t[x*2].w,t[x*2+1].w);}ll Ask(ll x,ll l,ll r,ll L,ll R){if(l==L&&r==R)return t[x].w;downdata(x);ll mid=(L+R)/2;if(r<=mid) return Ask(x*2,l,r,L,mid);if(l>mid) return Ask(x*2+1,l,r,mid+1,R);return max(Ask(x*2,l,mid,L,mid),Ask(x*2+1,mid+1,r,mid+1,R));}
}T,T2;
ll n,A,B,C,D,prev[N],next[N],id[N],last[N],f[N],ans,a[N];
bool cMp(ll x,ll y)
{return a[x]>a[y];}
ll Val(ll x)
{return A*x*x*x+B*x*x+C*x+D;}
int main()
{freopen("min.in","r",stdin);freopen("min.out","w",stdout);scanf("%lld%lld%lld%lld%lld",&n,&A,&B,&C,&D);for(ll i=1;i<=n;i++){scanf("%lld",&a[i]);id[i]=i;}for(ll i=1;i<=n;i++)prev[i]=i-1,next[i]=i+1;sort(id+1,id+1+n,cMp);prev[1]=1;for(ll i=1;i<=n;i++){ll x=id[i];last[x]=prev[x];prev[next[x]]=prev[x];next[prev[x]]=next[x];}T.Build(1,1,n);T2.Build(1,1,n);for(ll i=1;i<=n;i++){ll val=T2.Ask(1,last[i],i,1,n);T.Change(1,last[i],i,val+Val(a[i]),1,n);ans=T.t[1].w;T2.Change(1,i,i,ans,1,n);}printf("%lld",ans);
}
关于NOIPNOIPNOIP的死亡
呸!
反正我们教练说会有新的比赛,然后还在小道消息(牛客网的群上)看到
然后就是这样