题目链接:http://codeforces.com/contest/761/problem/D 题意:给出一个长度为n的a序列和p序列,求任意一个b序列使得c[i]=b[i]-a[i],使得c序列的大小顺序和p序列一样. p序列给出的的是1-n不重复的数.还有给出的l和r是b序列的大小范围 显然为了要使结果存在尽量使b取得最接近r,所以可以先按p排序一下,从大到小处理b,二分l,r的值使得每次的b尽量 大. #include <iostream> #include <cstring&g…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences a and b of length n each you need to wr…
http://codeforces.com/contest/761/problem/D c[i] = b[i] - a[i],而且b[]和a[]都属于[L, R] 现在给出a[i]原数组和c[i]的相对大小,要确定b[i] 因为已经知道了c[i]的相对大小,那么从最小的那个开始,那个肯定是选了L的了,因为这样是最小的数, 然后因为c[i]要都不同,那么记录最小的那个c[]的大小是mx,那么下一个就要是mx + 1,就是倒数第二小的那个. 也就是b[i]在[L, R]中选一个数,使得b[i] -…
D. Dasha and Very Difficult Problem 题目连接: http://codeforces.com/contest/761/problem/D Description Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences a and b of length n each you need to write a se…
题目链接:http://codeforces.com/contest/761/problem/D D. Dasha and Very Difficult Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dasha logged into the system and began to solve problem…
D. Dasha and Very Difficult Problem time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences…
题目链接 Dasha and Very Difficult Problem 求出ci的取值范围,按ci排名从小到大贪心即可. 需要注意的是,当当前的ci不满足在这个取值范围内的时候,判为无解. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a); i <= (b); ++i) + ; int a[N], b[N], c[N], op[N]; int l, r, L, R, cnt; b…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences a and b of length n each you need t…
题目链接:http://codeforces.com/contest/761/problem/C 题意:给出n行的字符串每一列都从第一个元素开始可以左右移动每一行字符串都是首位相连的. 最后问最少移动几次能够构成一个合理字符串,构成方法每一行取当前位置那个数.只要这个字符串 中有数字,有小写字母,有特殊符号就算合理. 先预处理一下每行到达各种符号所要移动的最小距离,最后设p[i][j][k][l] i=1表示有数字,0表示没有,j,k分别表示字母和特殊符号,l表示取到第l行. 最后p值表示最小要…
概率计算:P(某set) =  令:  和   现在考虑: 1.考虑某个集合,再加一个概率为Pi的朋友后能不能使总概率提高. 即: 由公式可知, 如果 S < 1,则delta > 0,则可以加入这个朋友. 2.如果要加一个朋友有两个候选的,其概率分别为Pi,Pj,(设Pi < Pj)那么加哪个会更优呢? Δi - Δj = P·pi·(1 - S) - P·pj·(1 - S) = P·(1 - S)·(pi - pj) > 0.  如果 S < 1 那么 pi > …