随笔分类 -  CF题解

摘要:题面 "传送门" 分析 引理1:三角形的面积$\times 2$一定是整数 由坐标系中的三角形面积公式 $$S=\frac{1}{2}(x_1y_2+x_2y_3+x_3y_1 x_1y_3 x_2y_1 x_3y_2)$$ 显然得证 故若$\frac{2nm}{k}$是整数,则有解,否则无解 引理 阅读全文
posted @ 2018-10-26 18:27 birchtree 阅读(246) 评论(0) 推荐(0)
摘要:题面传送门分析1.暴力做法首先先把每个数除以gcd(a1,a2…,an)gcd(a_1,a_2 \dots,a_n )gcd(a1​,a2​…,an​)可以O(namax)O(n\sqrt {a_{max}})O(namax​​)的时间内分解出所有数的质因数... 阅读全文
posted @ 2018-09-22 09:20 birchtree 阅读(419) 评论(0) 推荐(0)
摘要:题面传送门分析思路简单,但代码较复杂的贪心分类讨论:有0负数有奇数个:将绝对值最小(实际最大)的负数和0全部乘到一起,最后删掉0负数有偶数个:将0全部乘到一起,最后删掉0没有0负数有奇数个:将绝对值最小(实际最大)的负数删掉负数有偶数个:不删最后把剩下的数依... 阅读全文
posted @ 2018-09-18 18:14 birchtree 阅读(276) 评论(0) 推荐(0)
摘要:题面(http://codeforces.com/problemset/problem/843/D) 题目大意: 给定一张带权无向图,有q次操作 操作有两种 1 v 询问1到v的最短路 2 c 将边l1,l2…lc" role="present... 阅读全文
posted @ 2018-08-17 09:41 birchtree 阅读(1241) 评论(0) 推荐(0)
摘要:题面传送门 题目大意: 有n条线段,每条线段染红色或蓝色,使得数轴上每个点被红色线段覆盖的次数与被蓝色线段覆盖数差的绝对值小于等于1。输出染色方案。分析题意其实可以这样理解: 一段初始全为0 的序列a,给区间[li,ri]" role="presentati... 阅读全文
posted @ 2018-08-17 09:01 birchtree 阅读(235) 评论(0) 推荐(0)
摘要:题面传送门 题目大意: 给定一个无向连通带权图G,对于每条边(u,v,w)" role="presentation" style="position: relative;">(u,v,w)(u,v,w),求包含这条边的生成树大小的最小值分析包含这条边的生成树... 阅读全文
posted @ 2018-07-10 16:27 birchtree 阅读(288) 评论(0) 推荐(0)
摘要:题面传送门 题目大意: 给出一棵树,再给出k条树上的简单路径,求每条边被不同的路径覆盖了多少次分析解决这个问题的经典做法是树上差分算法 它的思想是把”区间”修改转化为左右端点的修改 在树上,每个节点初始权值为0,对于每条路径(x,y),我们令节点x的权值+1... 阅读全文
posted @ 2018-07-07 14:16 birchtree 阅读(410) 评论(0) 推荐(0)
摘要:题面:传送门分析:此题O(n2l)" role="presentation" style="position: relative;">O(n2l)O(n2l)模拟肯定是会超时的(l为所有字符串总长) 我们想到对字符串进行一定的预处理,可以快速计算匹配 我们设... 阅读全文
posted @ 2018-06-11 17:36 birchtree 阅读(176) 评论(0) 推荐(0)
摘要:题面:传送门 题目大意: 给定一个空集合,有两种操作: 一种是往集合中插入一个元素x,一种是给三个数x,k,s,问集合中是否存在v,使得gcd(x,v)%k==0,且x+vO(n−−√log2n)O(nlog2n) 操作2时间复杂度 O(log2n" rol... 阅读全文
posted @ 2018-06-02 19:47 birchtree 阅读(168) 评论(0) 推荐(0)
摘要:题面传送门 题目大意: L(h)的值是区间[L,R]内,abs(h[i]-h[j])/(i-j)的最大值。现在有q个询问,每个询问表示询问区间[L,R]内,所有子序列的L(h)的值的和分析将|h[i]−h[j]i−j|" role... 阅读全文
posted @ 2018-05-28 20:42 birchtree 阅读(179) 评论(0) 推荐(0)
摘要:题面 传送门 题目大意: 给你一个计算区间f函数的公式,举例f(1,2,4,8)=f(1⊕2,2⊕4,4⊕8)=f(3,6,12)=f(3⊕6,6⊕12)=f(5,10)=f(5⊕10)=f(15)=15 然后现在给你一个数列,n<=5000,然后q个询问,q<=100000,每次询问[l,r]区间 阅读全文
posted @ 2018-05-28 19:54 birchtree 阅读(197) 评论(0) 推荐(0)
摘要:题面 传送门:http://codeforces.com/problemset/problem/515/C Drazil is playing a math game with Varda. Let’s define f(x)f(x)for positive integer x as a produ 阅读全文
posted @ 2018-05-21 18:34 birchtree 阅读(213) 评论(0) 推荐(0)
摘要:题面:传送门:http://codeforces.com/problemset/problem/475/D Given a sequence of integers a1, …, an and q queries x1, …, xq on it. For e... 阅读全文
posted @ 2018-05-21 13:06 birchtree 阅读(423) 评论(0) 推荐(0)
摘要:题面 传送门:http://codeforces.com/problemset/problem/691/E E. Xor-sequences time limit per test3 seconds memory limit per test256 megabytes inputstandard i 阅读全文
posted @ 2018-05-15 20:10 birchtree 阅读(288) 评论(0) 推荐(0)
摘要:题面 传送门:http://codeforces.com/problemset/problem/833/B B. The Bakery time limit per test2.5 seconds memory limit per test256 megabytes inputstandard in 阅读全文
posted @ 2018-05-14 21:40 birchtree 阅读(251) 评论(0) 推荐(0)
摘要:题面 传送门:http://codeforces.com/problemset/problem/840/C C. On the Bench time limit per test2 seconds memory limit per test256 megabytes inputstandard in 阅读全文
posted @ 2018-05-09 19:02 birchtree 阅读(302) 评论(0) 推荐(0)