博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
BZOJ 1151 傲娇的人 排序
阅读量:7126 次
发布时间:2019-06-28

本文共 1654 字,大约阅读时间需要 5 分钟。

傲娇的人

Time Limit: 1 Sec  

Memory Limit: 256 MB

题目连接

http://acm.uestc.edu.cn/#/problem/show/1151

Description

有 N 个傲娇的人,你要指派他们去完成工作。只有当现在被指派的人完成了工作,你才能指派下一个。每个人完成工作需要花费 Ti 分钟,但!他们都好傲娇,他们都希望你马上就指派他,如果你拖延了 t 分钟才指派他,那么就需要付给他 tCi 元钱作为补偿。问,最少需要花费多少元钱才能去指派所有傲娇的人?

Input

第一行输入一个整数N (1N105)

第二行输入四个种子数abcd (1abcd10007)。你需要通过这4个种子数来得到 Ti 和 Ci,方法如下:

const int mod=10007; typedef long long ll; void getdata(int a,int b,int c,int d,int N,int *T,int *C){ T[0]=C[0]=0; for(int i=1;i<=N;i++){ T[i]=(T[i-1]*a+b)%mod+1; C[i]=(C[i-1]*c+d)%mod+1; } }

Output

第一行输出一个整数,表示最少需要花费多少钱去指派这些傲娇的人。

第二行输出 N 个整数,表示每次指派哪个人去,即按指派顺序输出被指派人的编号。比如,有5个人,按顺序指派他们,则输出"1 2 3 4 5"。如果有多解,输出字典序最小解。

Sample Input

5
1 1 1 1

Sample Output

340 
1 2 3 4 5

HINT

 

题意

 

题解:

排个序就好了

每个值对于后面的贡献度就是T[i]*其他的C[i]

然后根据这个排序就吼了

代码:

//qscqesze#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
typedef long long ll;using namespace std;//freopen("D.in","r",stdin);//freopen("D.out","w",stdout);#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)#define maxn 200500#define mod 10007#define eps 1e-9#define pi 3.1415926int Num;//const int inf=0x7fffffff;const ll inf=999999999;inline ll read(){ ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f;}//*************************************************************************************ll T[maxn];ll C[maxn];struct node{ ll x,y,z; friend bool operator < (const node & a,const node & b) { if(a.x*b.y

 

转载地址:http://xthel.baihongyu.com/

你可能感兴趣的文章
python+ddt+unittest+excel+request实现接口自动化
查看>>
第八周周记
查看>>
Jni Error(app bug): accessed stale local reference 的另类出现方式
查看>>
myeclipse 解决乱码问题
查看>>
iOS Https 配置 及AFN 相关配置
查看>>
Table-Valued Parameters in SQL Server 2008 (ADO.NET)
查看>>
推荐系统常用的算法参考
查看>>
[Todo] Java并发编程学习
查看>>
Redis cluster学习 & Redis常识 & sort操作
查看>>
mysql 中实现多条数据同时更新
查看>>
2011 ACM/ICPC 成都赛区(为2013/10/20成都现场赛Fighting)
查看>>
Linux技术进阶示意图
查看>>
php设计模式课程---6、策略模式如何使用
查看>>
html5--6-8 CSS选择器5
查看>>
20145328 《信息安全系统设计基础》第6周学习总结
查看>>
python学习笔记:"爬虫+有道词典"实现一个简单的英译汉程序
查看>>
基于theano的深度卷积神经网络
查看>>
vCenter 部件关系简介 & 网络原理
查看>>
Mysql优化的方法
查看>>
Web.config或App.config中数据库链接路径的问题
查看>>