Codeforces Round #466】的更多相关文章

Codeforces Round #466 (Div. 2) E. Cashback(dp + 贪心) 题意: 给一个长度为\(n\)的序列\(a_i\),给出一个整数\(c\) 定义序列中一段长度为k的区间的贡献为区间和减去前\(\lfloor \frac{k}{c} \rfloor\)小数的和 现在要给序列\(a_i\)做一个划分,使得贡献的总和最小. 思路: 容易想到最裸的dp的思路 \(dp[i] = min(dp[j] + cost(j,i)) , j < i\), \(cost(j,…
Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权值小于等于给定值d 题解: 排序,每次挑最大的和最小的,看看最小的能跟多少个数差\(>d\),看看最大的能跟多少个数差\(>d\),取个数大的那个删除.复杂度\(n^2 + n\log n\) 代码 #include <iostream> #include <cstdio>…
2018-02-25 http://codeforces.com/contest/940/problem/A A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We've got no test cases. A big olympiad is coming up. But the pr…
所有的题目都可以在CodeForces上查看 中间看起来有很多场比赛我没有写了 其实是因为有题目没改完 因为我不想改,所以就没有写了(大部分题目还是改完了的) 我还是觉得如果是打了的比赛就一场一场写比较好 要不然以后就写有难度的.比较好的题目?? 这场比赛时间真心良心(只是没吃饭) 状态也很好,考场上把\(ABCDE\)切了 \(F\)是自己弃疗了... 不管啦不管啦,进入正题了 题解 A.Points on the line 翻译: 给定一个长度为\(n\)的数组 问最少删去几个数之后使得最大…
从这里开始 题目列表 小结 Problem A Points on the line Problem B Our Tanya is Crying Out Loud Problem C Phone Numbers Problem D Alena And The Heater Problem E Cashback Problem F Machine Learning 小结 这场比赛和同学一起打.本来应该是很开心的事情,结果留下好多遗憾. 第一个遗憾是没能在20分钟内消灭A.B题.然后分数就不是很可观…
A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding anot…
人生中第三次\(CF\)... 考试中切了\(A\)~\(E\) \(F\)题会做没时间写 题解 A:Points on the line 题意 给定一个数列,删最小的数,使最大差不大于一个定值 Sol 排序后选的一定是段连续的区间,枚举左右端点即可 手速慢了233 # include <bits/stdc++.h> # define RG register # define IL inline # define Fill(a, b) memset(a, b, sizeof(a)) using…
A. Points on the line 题意 给定一条直线上\(n\)个点,要求去掉最少的点,使得直线上相距最远的两个点的距离\(\leq d\). 思路 枚举长度为\(d\)的区间. Code #include <bits/stdc++.h> #define F(i, a, b) for (int i = (a); i < (b); ++i) #define F2(i, a, b) for (int i = (a); i <= (b); ++i) #define dF(i,…
题意 给定$n$个数,将其划分成若干个连续的子序列,求最小价值,数组价值定义为,数组和减去$\lfloor \frac{k}{c} \rfloor$,$k$为数组长度,$c$为给定数 可以列得朴素方程$f_i=\min_{j \le i} {f_j+w(j+1,i)}$,复杂度$O(n^2)$ 考虑划分的区间长度$k$,若$k=c$,那么只需要去掉区间的最小值,若$k$是$c$的整数倍,那么需要去掉$k/c$个最小值,那么把$k$分成$k/c$个长度为$c$的段,删除的最小值为每个段的最小值之和…
B. Our Tanya is Crying Out Loud time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Right now she actually isn't. But she will be, if you don't solve this problem. You are given integers n, k,…