傲娇的人
Time Limit: 1 Sec
Memory Limit: 256 MB
题目连接
http://acm.uestc.edu.cn/#/problem/show/1151Description
有 N 个傲娇的人,你要指派他们去完成工作。只有当现在被指派的人完成了工作,你才能指派下一个。
每个人完成工作需要花费 Ti 分钟,但!他们都好傲娇,他们都希望你马上就指派他,如果你拖延了 t 分钟才指派他,那么就需要付给他 t⋅Ci 元钱作为补偿。问,最少需要花费多少元钱才能去指派所有傲娇的人?
Input
第一行输入一个整数N (1≤N≤105)
第二行输入四个种子数a,b,c,d (1≤a,b,c,d≤10007)。你需要通过这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