前言
Rank1Rank1Rank1耶
成绩
RankRankRank是有算别人的
RankRankRank | PersonPersonPerson | ScoreScoreScore | AAA | BBB | CCC |
---|---|---|---|---|---|
111 | 2017myself2017myself2017myself | 280280280 | 100100100 | 808080 | 100100100 |
333 | 2017xjq2017xjq2017xjq | 200200200 | 100100100 | 000 | 100100100 |
121212 | 2017hjq2017hjq2017hjq | 150150150 | 100100100 | 000 | 505050 |
303030 | 2017zyc2017zyc2017zyc | 100100100 | 100100100 | 000 | 000 |
303030 | 2017xxy2017xxy2017xxy | 100100100 | 100100100 | 000 | 000 |
303030 | 2017lrz2017lrz2017lrz | 100100100 | 100100100 | 000 | 000 |
303030 | 2017hzb2017hzb2017hzb | 100100100 | 100100100 | 000 | 000 |
303030 | 2017lw2017lw2017lw | 100100100 | 100100100 | 000 | 000 |
正题
T1:jzoj4244−yiT1:jzoj4244-yiT1:jzoj4244−yi【贪心】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86689041
T2:jzoj4245−erT2:jzoj4245-erT2:jzoj4245−er【dp,dp,dp,贪心】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86689149
T3:jzoj4246−sanT3:jzoj4246-sanT3:jzoj4246−san【最短路,SPFA,DAGdp,SPFA,DAGdp,SPFA,DAGdp】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86689203
someofcodesome\ of\ codesome of code
T2 80分code
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int N=110;
int n,m,k,add[N],sum[N],cnt1,cnt2,mul[N];
int fff,f[N][N*2000],maxs[N],a1,a2;
double ans,summ[N];
bool cmp(int x,int y)
{return x>y;}
int main()
{scanf("%d%d%d",&n,&m,&k);scanf("%d",&a1);if(n==2) scanf("%d",&a2);for(int i=1;i<=m;i++){int x,t;scanf("%d%d",&t,&x);if(t==1) fff=x;if(t==2) add[++cnt1]=x;if(t==3) mul[++cnt2]=x;}sort(add+1,add+1+cnt1,cmp);sort(mul+1,mul+1+cnt2,cmp);sum[0]=a1+a2;for(int i=1;i<=max(cnt1,cnt2);i++){summ[i]=summ[i-1]+log(mul[i]);sum[i]=sum[i-1]+add[i];}memset(f,0xcf,sizeof(f));f[0][a1]=a1*a2;for(int i=0;i<=cnt1;i++){for(int j=a1;j<=sum[i];j++){f[i+1][j]=max(f[i][j]+add[i+1]*j,f[i+1][j]);f[i+1][j+add[i+1]]=max(f[i][j]+add[i+1]*(sum[i]-j),f[i+1][j+add[i+1]]);maxs[i]=max(maxs[i],f[i][j]);}}for(int u=0;u<=k;u++){int mu=k-u;ans=max(ans,log(maxs[u])+summ[mu]);}if(fff){k--;sum[0]=fff+a2;for(int i=1;i<=cnt1;i++)sum[i]=sum[i-1]+add[i];memset(f,0xcf,sizeof(f));memset(maxs,0,sizeof(maxs));f[0][fff]=fff*a2;for(int i=0;i<=cnt1;i++){for(int j=fff;j<=sum[i];j++){f[i+1][j]=max(f[i][j]+add[i+1]*j,f[i+1][j]);f[i+1][j+add[i+1]]=max(f[i][j]+add[i+1]*(sum[i]-j),f[i+1][j+add[i+1]]);maxs[i]=max(maxs[i],f[i][j]);}}for(int u=0;u<=k;u++){int mu=k-u;ans=max(ans,log(maxs[u])+summ[mu]);}sum[0]=a1+fff;for(int i=1;i<=cnt1;i++)sum[i]=sum[i-1]+add[i];memset(f,0xcf,sizeof(f));memset(maxs,0,sizeof(maxs));f[0][a1]=a1*fff;for(int i=0;i<=cnt1;i++){for(int j=a1;j<=sum[i];j++){f[i+1][j]=max(f[i][j]+add[i+1]*j,f[i+1][j]);f[i+1][j+add[i+1]]=max(f[i][j]+add[i+1]*(sum[i]-j),f[i+1][j+add[i+1]]);maxs[i]=max(maxs[i],f[i][j]);}}for(int u=0;u<=k;u++){int mu=k-u;ans=max(ans,log(maxs[u])+summ[mu]);}}printf("%.3lf",ans);
}
T2 60分code
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=110;
int n,m,k,a1,t,x,add[N],mul[N],cnt1,cnt2,f,a2;
double ans,sum[N];
bool cmp(int x,int y)
{return x>y;}
void check_nf(int A1,int A2)
{for(int u=0;u<=min(k,cnt1);u++){int a1=A1,a2=A2;for(int i=1;i<=u;i++)if(n==1||a1<a2) a1+=add[i];else a2+=add[i];//printf("%d %d\n",a1,a2);ans=max(ans,log(a1)+log(a2)+sum[min(k-u,cnt2)]);}
}
void check_f(int A1,int A2)
{k--;if(A1<A2) A1=f;else A2=f;for(int u=0;u<=min(k,cnt1);u++){int a1=A1,a2=A2;for(int i=1;i<=u;i++)if(n==1||a1<a2) a1+=add[i];else a2+=add[i];ans=max(ans,log(a1)+log(a2)+sum[min(k-u,cnt2)]);}
}
int main()
{//freopen("data.in","r",stdin);//freopen("data.ans","w",stdout);scanf("%d%d%d",&n,&m,&k);scanf("%d",&a1);if(n==2) scanf("%d",&a2);for(int i=1;i<=m;i++){int t,x;scanf("%d%d",&t,&x);if(t==1) f=x;else if(t==2)add[++cnt1]=x;else if(t==3)mul[++cnt2]=x;}sort(add+1,add+1+cnt1,cmp);sort(mul+1,mul+1+cnt2,cmp);for(int i=1;i<=cnt2;i++)sum[i]=sum[i-1]+log(mul[i]);check_nf(a1,a2);if(f) check_f(a1,a2);printf("%0.3lf",ans);}
总结
T1看完题之前以为是之前做过的一道恶心的dp,结果发现是水题,切掉。然后看T2,开始不会自然对数,结果发现就是log,然后写了个贪心先。之后看T3,先写了一个多源最短路,然后发现之后不会,之后仔细看一下题目,发现其实只有最短路上的边有用,这样就是有向无环图了,切掉。
之后T2怕贪心是错的,写个dp,调了半天。只有80。考完后发现是没有特判n=1的情况。
看题预估分(100+20+30=150)(100+20+30=150)(100+20+30=150)
做题预估分(100+50+50=200)(100+50+50=200)(100+50+50=200)
实际分数(100+80+100=280)(100+80+100=280)(100+80+100=280)
Rank1?Rank1?Rank1?还可以耶
尾声
没有尾声