Codeforces_problem
文章平均质量分 71
9974
这个作者很懒,什么都没留下…
展开
-
Codeforces 70D 动态凸包 (极角排序 or 水平序)
题目链接:http://codeforces.com/problemset/problem/70/D本题关键:在log(n)的复杂度内判断点在凸包 或 把点插入凸包判断:平衡树log(n)内选出点所属于的区域插入:平衡树log(n)内选出点所属于的区域, 与做一般凸包的时候类似,分别以该点向左右两边进行维护,一直删除不满足凸包的点,直到所有点满足凸包为止。水平序:原创 2013-08-30 22:23:31 · 3297 阅读 · 2 评论 -
Codeforces DP第二弹
比赛链接 代码全在里面 打*的算是好题吧1 / 1Problem ACodeForces 61DEternal Victory1 / 3Problem BCodeForces 67APartial Teacher1 / 3Problem CCodeForces 148EPorcelain原创 2014-03-31 19:08:28 · 1585 阅读 · 0 评论 -
Codeforces dp第一弹
1 / 3Problem ACodeForces 337APuzzles1 / 2Problem BCodeForces 4CRegistration system1 / 1Problem CCodeForces 144CAnagram Search1 / 3Problem DCodeForces 358D原创 2014-03-21 17:10:29 · 1573 阅读 · 0 评论 -
Codeforces DP第三弹
基本都是div2的D,E题比赛链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=43325#overview1 / 10Problem ACodeForces 132CLogo Turtle1 / 5Problem BCodeForces 8CLooking for原创 2014-04-03 11:48:38 · 1264 阅读 · 2 评论 -
codeforces 251B Playing with Permutations 模拟
View Code #include#includeint q[103], p[103], s[103], pp[103];int n, k, a, b;int main(){ int i, j; scanf("%d%d", &n, &k); for(i = 1; i ) scanf("%d", &q[i]);原创 2013-08-29 10:37:46 · 1136 阅读 · 0 评论 -
CodeForces 55D 数位DP 能被它自身数位上的所有数整除
#include #include #include #include using namespace std;#define LL __int64int id, mp[2555];LL dp[22][55][2525];int a[22];int gcd(int a, int b) { return b ? gcd(b, a%b) : a;}int LCM(int原创 2013-04-13 10:28:38 · 1228 阅读 · 0 评论 -
codeforces 148D 概率dp 记忆化搜索
题意: 袋子里有w只白鼠和b只黑鼠 龙和公主轮流从袋子里抓老鼠。谁先抓到白色老师谁就赢。 公主每次抓一只老鼠,龙每次抓完一只老鼠之后会有一只老鼠跑出来。 每次抓老鼠和跑出来的老鼠都是随机的。 如果两个人都没有抓到白色老鼠则龙赢。公主先抓。 问公主赢的概率。解析: 这题选用记忆化搜索还是比较容易的,不容原创 2013-08-12 13:04:55 · 1669 阅读 · 0 评论 -
CF 86D Powerful array 分块算法入门,n*sqrt(n)
简介:分块算法主要是把区间划分成sqrt(n)块,从而降低暴力的复杂度,其实这算是一种优化的暴力吧,复杂度O(n*sqrt(n))题意:给定一个数列:a[i] (1有t个查询,每个查询l,r,对区间内所有a[i],求sigma(K[a[i]]^2*a[i])思路:离线+分块处理 分块和离线处理:将n个数分成sqrt(n)原创 2013-08-18 19:31:47 · 2293 阅读 · 2 评论 -
Codeforces 258B 数位DP
递归#include #include #include #define LL __int64const LL mod = 1000000007;LL dp[11], ans;int len;char a[11];void add(int dep, int dig, int num){ if(!dep) { dp[dig] += num;原创 2013-03-17 19:54:50 · 1224 阅读 · 0 评论 -
codeforces 253D 单调队列 好题
View Code #include #include #include using namespace std;char map[404][404];int a[404][404]; int n, m, k, sum;__int64 ans;int cnt[33]; int main(){ freopen("input.txt", "r"原创 2013-08-29 10:37:49 · 1252 阅读 · 0 评论 -
codeforces 252B Unsorting Array 暴力+贪心
失算啊,水题啊,比赛没AView Code #include#include#includeusing namespace std;int a[100005], b[100005];int main(){ int i, j, n; scanf("%d", &n); for(i = 0; i ) scanf("%d"原创 2013-08-29 10:37:44 · 933 阅读 · 0 评论 -
Codeforces 375D 数据结构(好题中的好题, 4解)
题目链接:http://codeforces.com/problemset/problem/375/D全部代码:题意:给你一棵树n个点,m次询问(n=100000,m=100000),每个节点有一种颜色, 每次询问问你以v节点为根的子树中 满足 同一种颜色的个数>=k的 颜色有几个。方法1:显然询问要离线处理,不妨用思维简单的分块算法处理询问,原创 2014-03-25 19:38:09 · 2785 阅读 · 0 评论