Section 4.2 jobs
来源:互联网 发布:算法时代 编辑:程序博客网 时间:2024/06/09 12:12
/*
ID: niepeng1
PROG: job
LANG: C++
*/
/*
看了题解。
最短的时间就是将任务完成a步骤的时间排序(升),将b任务完成的步骤排序(降),然后对应相加即得到最小的任务完成时间为相加n项中的最大值。
*/
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include <iostream>
#include<functional>
using namespace std;
#define mmax(a,b) a>b?a:b
#define Max1 100000
int a[31],b[31];
int lena[31],lenb[31],overal[1001],overbl[1001];
int n,ma,mb;
int maxb;
int main()
{
freopen( "job.in", "r",stdin);
freopen( "job.out", "w",stdout);
int i,j,pointa,pointb;
bool cond=false;
scanf("%d%d%d",&n,&ma,&mb);
for(i=0;i<ma;i++)
scanf("%d",&a[i]);
for(i=0;i<mb;i++)
scanf("%d",&b[i]);
for(i=0;i<n;i++)
{
pointa=0;
for(j=0;j<ma;j++)
if( lena[pointa]+a[pointa] > lena[j]+a[j] )
pointa=j;
lena[pointa]+=a[pointa];
overal[i]=lena[pointa];
}
for(i=0;i<n;i++)
{
pointb=0;
for(j=0;j<mb;j++)
if( lenb[pointb]+b[pointb] > lenb[j]+b[j] )
pointb=j;
lenb[pointb]+=b[pointb];
overbl[i]=lenb[pointb];
}
sort(overal,overal+n,less<int>());
sort(overbl,overbl+n,greater<int>());
printf("%d ",overal[n-1]);
for(i=0;i<n;i++)
maxb=mmax(maxb,overal[i]+overbl[i]);
printf("%d/n",maxb);
return 0;
}
- Section 4.2 jobs
- jobs
- Section 4.2 cowcycle
- Section 4.2 ditch
- Section 4.2 stall4
- section
- Section()
- USACO Section 4.2 Cowcycles - 枚举~
- USACO Section 4.2 Job Processing
- back jobs
- Hunting Jobs!
- ORACLE JOBS
- sample jobs
- Pegasystems Jobs
- Steve Jobs
- ORACLE JOBS
- ORACLE JOBS
- Steve jobs
- 函数模板
- PE文件格式学习总结
- 虚函数
- HDU1001
- Section 4.3 lgame
- Section 4.2 jobs
- 世界各个国家及其国家代码
- 如果不用MFC,直接使用API写一个Windows程序,需哪些步骤?MFC是怎么做到菜单点击后,响应对应的代码的?
- Section 4.1 Beef McNuggets
- Postfix+Amavisd+Clam+Spamd
- CentOS LAMP环境搭建和测试php与mysql的连接
- 线程
- 最简单的glut opengl程序
- 线程2