[CodeForces - 614D] D - Skills】的更多相关文章

D - Skills Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-negative integer ai…
排序+枚举+二分 最大的那些变成A,小的那部分提高最小值 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; +; int n; long long A,cf,cm,m; struct X { long long a; long long ans; int id; } s[maxn]; long long sum[maxn];…
链接 大意: $n$门课, 第$i$门分数$a_i$, 可以增加共$m$分, 求$cnt_{mx}*cf+mi*cm$的最大值 $cnt_{mx}$为满分的科目数, $mi$为最低分, $cf$, $cm$为给定系数 暴力枚举达到满分的科目数, 再二分答案求出最低分的最大值, 复杂度是$O(nlognlogmx)$ 似乎可以双指针省去二分答案的log, 不过懒得写了.. #include <iostream> #include <algorithm> #include <cs…
题目链接:http://codeforces.com/problemset/problem/581/C 题目意思:给出 n 个数:a1, a2, ..., an (0 ≤ ai ≤ 100).给出值 k,可以把它加到任意的 ai 中,成为ai',对每个ai 加多少随你定,但是不能超过 100,k也不一定需要用完.现在需要求得最终的和⌊a1'⌋+⌊a2'⌋ + ... + ⌊an'⌋,使其最大. 比赛的时候真的很中规中矩地做,有那么一点思路:将 k 中的某些unit 加入到每个数中(而且优先需要处…
题目链接: B. Skills time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was…
题 题意 给你n个数,可以花费1使得数字+1,最大加到A,最多花费m.最后,n个数里的最小值为min,为A的有k个,给你cm和cf,求force=min*cm+k*cf 的最大值,和n个数操作后的结果. 分析 我们如果要让最小值增加,那它加到和第二小的一样时,就有两个最小值,接下来就要两个一起增加..到后来就要好多个一起增加了. 那么我们可以枚举加到A的有多少个,然后用二分的方法求剩下m元,可以使最小值最大为多少. 怎么二分呢? l=0,r=A.mid=(l+r)/2. 我们假设现在是最小值为m…
题意(CodeForces 614D) 每个人有\(n(n\le 10^5)\)个技能,技能等级都在\([0,10^9]\)的范围,每个技能有一个当前等级,所有技能的最高等级都为A.一个人的力量被记做以下两项的和: 1. 顶级技能的个数 *cf 2. 最低等级的技能 *cm 每个单位的钱能够提升一级力量.我们希望花尽可能少的钱,使得力量尽可能高. 分析 我二分的功力还是不足,要多努力.这题其实是一个非常明显的暴力:我们枚举提高到A的等级的个数(到不能提升为止),枚举这种情况下,我们能够令把多少人…
C. Developing Skills Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/problem/C Description Petya loves computer games. Finally a game that he's been waiting for so long came out! The main character of this game has n dif…
B. Skills 题目连接: http://www.codeforces.com/contest/613/problem/B Description Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly…
大意: $n$门课, 第$i$门分数$a_i$, 可以增加共$m$分, 求$cnt_{mx}*cf+mi*cm$的最大值 $cnt_{mx}$为满分的科目数, $mi$为最低分, $cf$, $cm$为给定系数 枚举满分的个数, 双指针求出最低分的最大值. #include <iostream> #include <sstream> #include <algorithm> #include <cstdio> #include <math.h>…