B. Ancient Berland Hieroglyphs 题目连接: http://codeforces.com/problemset/problem/164/B Descriptionww.co Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hierog…
C. Ancient Berland Circus time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.…
Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary fro…
easy 题目链接 & hard 题目链接 给出一张 \(n \times m\) 的矩阵,每个格子上面有一个数,你要在每行选出一个点 \((i,t)\),并覆盖左上角为 \((i,t)\),右下角为 \((\min(i+1,n),\min(t+k-1,m))\) 的矩形.求被覆盖的格子上数的和的最大值. easy 数据范围:\(1 \leq n \leq 50\),\(1 \leq m \leq 2 \times 10^4\),\(1 \leq k \leq 20\). hard 数据范围:\…
题目链接: http://codeforces.com/contest/6/problem/E E. Exposition time limit per test 1.5 secondsmemory limit per test 64 megabytes 问题描述 There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection th…
B. Psychos in a Line Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/319/B Description There are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who h…
题目链接:http://codeforces.com/problemset/problem/455/A 题目大意:有n个数,每次可以选择删除一个值为x的数,然后值为x-1,x+1的数也都会被删除,你可以获得分值x,求出能获得的最大分值为多少. 解题思路:从小到大排序,去重一下, 用cnt[i]记录一下数字i出现次数.那么可以得到状态转移方程:dp[i]=max(dp[i],dp[j]+cnt[i]*a[i])(j<i&&a[i]-a[j]>1),再用单调队列优化一下就行了O(∩…
C. Ancient Berland Circus 题目连接: http://www.codeforces.com/contest/1/problem/C Description Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different. In Ancient Berland arenas in circuses were s…
题目链接:http://codeforces.com/problemset/problem/1029/B 题目大意:从数组a中选出一些数组成数组b,要求 b[i+1]<=b[i]*2 . 一开始想到的是O(n^2)的动态规划,但是超时了,下面是超时的代码. #include <iostream> using namespace std; const int maxn = 200020; int n, a[maxn], f[maxn], res = 0; int main() { cin…
Codeforces 940 E.Cashback 题意:一组数,要分为若干个区间,每个区间长度为ki(1<=ki<=n),并且对于每个区间删去前ki/c(向下取整)个小的数(即对区间升序排序后的前ki/c个数),要求找出最佳的划分方案使所有最终数组的和最小 思路:通过观察和分析 ①一个长度2*c的区间总是不会优于把它划分成两个长度为c的区间 ②在一个长度为c的区间后面添不超过c个数,都不会使删掉的数之和变大,还可能更小. 因此得到dp状态与转移方程: dp[i]:前i个数最大可删掉数之和 d…