2017 多校4 Dirt Ratio】的更多相关文章

多校4 Dirt Ratio(二分+线段树) 题意: 给出n个数,找一段区间使得区间内不同数字个数除以区间长度最小,求这个最小值,\(n<=60000,a_i<=n\) 题解: 二分答案mid,检验是否存在一个区间满足\(\frac{size(l,r)}{r-l+1}\leq mid ​\),也就是\(size(l,r)+mid\times l\leq mid\times (r+1)\) 从左往右枚举每个位置作\(r\),当rr变化为\(r+1\)时,对\(size\)的影响是一段区间加1,线…
比赛时会错题意+不知道怎么线段树维护分数- - 思路来自题解 /* HDU 6070 - Dirt Ratio [ 二分,线段树 ] | 2017 Multi-University Training Contest 4 题意: 给出 a[N]; 设 size(l,r)为区间(l,r)不同数字的个数,求 size(l,r)/(r-l+1) 的最小值 限制: N <= 6e5, a[i] <= 6e5 分析: 二分答案 mid 则判定条件为是否存在 size(l,r)/(r-l+1) <=…
题目链接 Problem Description In ACM/ICPC contest, the ''Dirt Ratio'' of a team is calculated in the following way. First let's ignore all the problems the team didn't pass, assume the team passed X problems during the contest, and submitted Y times for t…
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6070 题面: Dirt Ratio Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1599    Accepted Submission(s): 740Special Judge Problem Description In…
Dirt Ratio Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Special Judge Problem Description In ACM/ICPC contest, the ''Dirt Ratio'' of a team is calculated in the following way. First let's ignore all the proble…
Dirt Ratio Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1473    Accepted Submission(s): 683Special Judge Problem Description In ACM/ICPC contest, the ''Dirt Ratio'' of a team is calculated…
/** 题目:hdu6070 Dirt Ratio 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6070 题意:给定n个数,求1.0*x/y最小是多少.x表示一段区间内不同数字的个数,y表示区间长度. 思路:二分+线段树 二分答案x/y. 找一段区间满足 size(l,r)/(r-l+1) <= mid , size(l,r)表示[l,r]内不同数的个数. size(l,r)<=mid(r-l+1) => size(l,r)+mid*l<…
2017 多校5 Rikka with Number(数学 + 数位dp) 题意: 统计\([L,R]\)内 有多少数字 满足在某个\(d(d>=2)\)进制下是\(d\)的全排列的 \(1 <= L <= R <= 10^{5000}\) 题解: 首先转化成计算小于等于 \(N\)的好数有多少个.因为 \(n^n<(n+1)^n\) ​ ​​而对于 \(n\) 进制下的任何一个好数 \(K\),都有 \(n^{n-1}<K<n^n ​\) ​​ ​​ ,所以每一…
2017 多校5 Rikka with String(ac自动机+dp) 题意: Yuta has \(n\) \(01\) strings \(s_i\), and he wants to know the number of \(01\) antisymmetric strings of length \(2L\) which contain all given strings \(s_i\) as continuous substrings. A \(01\) string \(s\) i…
2017 多校4 Wavel Sequence 题意: Formally, he defines a sequence \(a_1,a_2,...,a_n\) as ''wavel'' if and only if \(a_1<a_2>a_3<a_4>a_5<a_6\)... Now given two sequences \(a_1,a_2,...,a_n\) and \(b_1,b_2,...,b_m\), Little Q wants to find two seque…