bzoj4868&&5213jzoj[Shoi2017]期末考试 枚举或三分
来源:互联网 发布:淘宝最好的饰品店 编辑:程序博客网 时间:2024/05/17 06:39
题意不能一句话,所以不写了。
训练比赛的时候手抖结果删注释的时候把下面一句更新天数的给删掉了100—>10巨亏。
还是比较好想的,枚举最后一天在什么时候,然后用前缀和来更新一下每一种方案的可行性,具体看代码。
%%%打三分的dalao们,一万年不打三分的我菜的不行。。
#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#define fo(i,a,b) for(int i=a;i<=b;i++)#define fd(i,a,b) for(int i=a;i>=b;i--)using namespace std;const int N=1e5+5;typedef long long ll;int n,m,A,B,C,k;const ll inf=1e16;ll a[N],b[N],c[N];ll cost,l,step;ll ans;int main(){ scanf("%d%d%d%d%d",&A,&B,&C,&n,&m); fo(i,1,n) { int x; scanf("%d",&x); a[x]++,k=max(k,x); } fo(i,1,m) { int x; scanf("%d",&x); b[x]++; k=max(k,x); } fo(i,1,k) { cost+=a[i]*(k-i); l+=b[i]*(k-i); a[i]+=a[i-1]; b[i]+=b[i-1]; } ans=cost*C; fd(i,k-1,1) { step+=(m-b[i]); l-=b[i]; cost-=a[i]; ll p=l>0?l:0; if(step<p)p=step; if(A<B)ans=min(ans,p*A+(step-p)*B+cost*C); else ans=min(ans,step*B+cost*C); } printf("%lld\n",ans); return 0;}
阅读全文
0 0
- bzoj4868&&5213jzoj[Shoi2017]期末考试 枚举或三分
- BZOJ4868 [Shoi2017]期末考试
- [BZOJ4868][Shoi2017]期末考试
- BZOJ4868: [Shoi2017]期末考试
- bzoj 4868: [Shoi2017]期末考试 三分答案
- 【SHOI&SXOI2017】bzoj4868 期末考试
- 4868: [Shoi2017]期末考试
- BZOJ 4868 [Shoi2017] 期末考试
- BZOJ 4868: [Shoi2017]期末考试 (三分法)
- Hdu 4454 Stealing a Cake(枚举或三分)
- 洛谷 P3745 [六省联考2017]期末考试(bzoj P4868 [Shoi2017]期末考试)
- 2013数据结构课程设计之便利店选址(暴力枚举或随机函数或三分)
- HDU2438 三分枚举角度
- 期末考试
- 期末考试
- 期末考试
- 期末考试????
- 期末考试
- HTML基础
- [算法基础]归并排序
- CentOS(Linux) SVN服务器搭建+同步更新+多版本库+开机启动
- java中instanceof用法
- android (xutlis)
- bzoj4868&&5213jzoj[Shoi2017]期末考试 枚举或三分
- 自定义view圆环跟随progressbar进度改变中心的texview(百分比)
- Android 三秒跳转另一个页面
- (31)Object类中equals()方法
- 计提凭证两种处理方案
- httpurlconnectionpost
- 编译--链接--被执行
- 【Linux】ALL常用命令
- 整数中1出现的次数(从1到n中出现的次数)