欢乐纪中A组赛【2019.8.9】

前言

在短暂的比赛时间中,我发现本菜鸡越是功于心计想ACACAC,越是拿不到分,所以。。。

我不写比赛了JOJO!JOJO!JOJO!


成绩

JJJ表示初中,HHH表示高中后面加的是几年级

RankRankRank PersonPersonPerson ScoreScoreScore AAA BBB CCC
171717 (J−3)WYC(J-3)WYC(J3)WYC 190190190 100100100 000 909090
242424 (H−1)ZZY(H-1)ZZY(H1)ZZY 175175175 353535 404040 100100100
303030 (H−2)HJW(H-2)HJW(H2)HJW 160160160 100100100 000 606060
363636 (J−3)ZYC(J-3)ZYC(J3)ZYC 140140140 757575 000 656565
434343 (J−3)XXY(J-3)XXY(J3)XXY 130130130 808080 555 454545
505050 (J−3)HJQ(J-3)HJQ(J3)HJQ 105105105 000 555 100100100
525252 (J−3)HZB(J-3)HZB(J3)HZB 100100100 555555 555 404040
757575 (H−2)LZX(H-2)LZX(H2)LZX 707070 252525 555 404040
777777 (H−1)WHF(H-1)WHF(H1)WHF 656565 606060 555 000
888888 (H−1)QYH(H-1)QYH(H1)QYH 404040 000 404040 000
929292 (J−3)XJQ(J-3)XJQ(J3)XJQ 353535 303030 555 000
929292 (J−3)LRZ(J-3)LRZ(J3)LRZ 353535 000 000 353535
100100100 (J−3)LW(J-3)LW(J3)LW 100100100 101010 000 000
104104104 (H−2)YJY(H-2)YJY(H2)YJY 000 000 000 000

正题


T1:jzoj6286,P4442−T1:jzoj6286,P4442-T1:jzoj6286,P4442走格子(Portal)(Portal)(Portal)BFS,SPFABFS,SPFABFS,SPFA

链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/98976611


T2:jzoj6287−T2:jzoj6287-T2:jzoj6287扭动的树【区间dpdpdp

链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/98978000


T3:jzoj6288−T3:jzoj6288-T3:jzoj6288旋转子段【优雅的暴力】

链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/98987138


总结

今天T1T1T1之前见过,然后就写了完了以后就自己举出了一个反例?????????然后放着去看后面,T3T3T3只会O(n2)O(n^2)O(n2)暴力就写了个。然后回来刚T1T1T1,发现有一个简单的点的方法就写完了,然后就切掉了。然后看T2T2T2,这不是区间dpdpdp吗?然后只会写O(n4)O(n^4)O(n4)的就写了骗分
看题预估分
100+0+60=160100+0+60=160100+0+60=160
做题预估分
100+70+60=230100+70+60=230100+70+60=230
实际获得分
100+0+90=190100+0+90=190100+0+90=190
T3T3T3竟然能水这么高分,T2T2T2竟然MLEMLEMLE了???连n3n^3n3的数组都开不了???


SomeofcodeSome of codeSome of code


T2MLEcodeT2 MLE codeT2 MLE code

#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const ll N=310;
struct node{ll k,p;
}a[N];
ll n,f[N][N][N],g[N][N],ans,s[N][N];
bool v[N][N];
bool cmp(node x,node y)
{return x.k<y.k;}
int main()
{freopen("tree.in","r",stdin);freopen("tree.out","w",stdout);scanf("%lld",&n);for(ll i=1;i<=n;i++)scanf("%lld%lld",&a[i].k,&a[i].p);sort(a+1,a+1+n,cmp);for(ll i=1;i<=n;i++)f[i][i][i]=g[i][i]=a[i].p;for(ll i=1;i<=n;i++)for(ll j=i;j<=n;j++){v[i][j]=(__gcd(a[i].k,a[j].k)==1);s[i][j]=s[i][j-1]+a[j].p;}if(n<=120){for(ll l=2;l<=n;l++){for(ll i=1;i<=n-l+1;i++){ll j=i+l-1;for(ll k=i;k<=j;k++){ll A=0,B=0;for(ll z=i;z<k;z++)if(!v[z][k]) A=max(A,f[z][i][k-1]);for(ll z=k+1;z<=j;z++)if(!v[k][z]) B=max(B,f[z][k+1][j]);f[k][i][j]=A+B+s[i][j];if(!A&&k>i||!B&&k<j) f[k][i][j]=-2147483647;if(l==n) ans=max(ans,f[k][i][j]);}}}}else{for(ll l=2;l<=n;l++){for(ll i=1;i<=n-l+1;i++){ll j=i+l-1;for(ll k=i;k<=j;k++){f[k][i][j]=g[i][k-1]+g[k+1][j]+s[i][j];g[i][j]=max(g[i][j],f[k][i][j]);}if(l==n) ans=max(ans,g[i][j]);}}}if(!ans) printf("-1");else printf("%lld",ans);
}

T390ptscodeT3 90pts codeT3 90pts code

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=101000;
int n,a[N],s[N],ans,maxs;
int main()
{freopen("rotate.in","r",stdin);freopen("rotate.out","w",stdout);scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]),s[i]=s[i-1]+(a[i]==i);for(int i=1;i<=n;i++){int l=i,r=a[i];ans=0;if(l>r) swap(l,r);for(int j=0;j<=r-l;j++)if(a[l+j]==r-j) ans++;maxs=max(maxs,s[n]-s[r]+s[l-1]+ans);//printf("%d,%d %dn",l,r,ans);}printf("%d",maxs);
}

后记(次日)

话说昨晚写比赛去了就没来得及写完blogblogblog。不过比赛也是水到了Rank80Rank80Rank80的高名次
在这里插入图片描述

创作挑战赛新人创作奖励来咯,坚持创作打卡瓜分现金大奖

Published by

风君子

独自遨游何稽首 揭天掀地慰生平