自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 D. Expected diameter of a tree(树形dp+期望)

  【题目链接】 http://codeforces.com/contest/804/problem/D 【题目大意】   给你一个森林,每次询问给出u,v,   从u所在连通块中随机选出一个点与v所在连通块中随机选出一个点相连,   问你此时相连出的树的直径期望是多少?(如果本身就在同一个连通块内,则输出-1) 【题解】   我们利用树形dp记录每个点属于的连通块,   以及每个点到不...

2018-11-29 19:18:28 158

转载 codeforces 804B——Ice cream coloring(图论,dfs,数据结构,好题)

C. Ice cream coloring time limit per test 2 seconds memory limit per test 256 megabytes Isart and Modsart were trying to solve an interesting problem when suddenly Kasra arrived. Breathless, he asked:...

2018-11-28 22:36:29 148

转载 Codeforces-798C-Mike and gcd problem(贪心+数论)

题目链接:Codeforces-798C-Mike and gcd problem  因为d|ad|a && d|bd|b -> d|(ax+by)d|(ax+by)  d|(a−b)d|(a−b) && d|(a+b)d|(a+b) -> d|2ad|2a && d|2bd|2b 所以要将 gcd(ai)=1gcd(ai)=1 转化成 ...

2018-11-28 00:02:48 114

转载 Codeforces 796D Police Stations (bfs+思维)

Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own. Ruling a country is not an easy job. Thieves and terrorists are always ready to r...

2018-11-26 23:00:09 211

原创 Codeforces-786B-Legacy (线段树+最短路)

看到区间很容易就能想到线段树。  对于操作2,我们可以建立一棵线段树,线段树的某一个结点表示区间 [l,r] ,那么在图中建立一个结点 u 表示区间 [l,r] ,新建点u 指向 l,l+1,l+2...r的边,权值为 0 。  当得到一个操作 (v,l,r,w) 时,查询一次线段树,把所有符合 [ql,qr]∈[l,r] 的极大区间结点建立一条被 v 指向的边,权值为 w 。这样就能表示 v指向...

2018-11-23 19:03:22 189

原创 A. Berzerk (SPFA博弈)

A. Berzerk Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer. In this ...

2018-11-22 23:35:07 165

转载 Codeforces Round #404 (Div. 2) E. Anton and Permutation(树状数组套主席树 求出指定数的排名)

题意很简单,就是动态的求区间逆序数。树状数组套主席树(内层主席树外层树状数组)好像就是个线段树 https://www.cnblogs.com/jianrenfang/p/6568645.html https://blog.csdn.net/qq_33183401/article/details/65451604...

2018-11-22 15:06:35 103

原创 B. Bitwise Formula

B. Bitwise Formula Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit dept...

2018-11-21 10:00:59 156

原创 codeforces-777E Hanoi Factory 树状数组+dp

codeforces-777E Hanoi Factory  题目传送门 题目大意: 现在一共有N个零件,如果存在:bi>=bj&&bj>ai的两个零件i,j,那么此时我们就可以将零件j放在零件i上。我们现在要组成一个大零件,使得高度最高,问这个最高高度。 n2 dp的优化,树状数组维护前缀max(当修改一直变大,或一直变小可以用树状数组维护;一开始看错成bi&...

2018-11-20 15:03:39 180

转载 Codeforces 776E: The Holmes Children (数论 欧拉函数)

题目链接 先看题目中给的函数f(n)和g(n)   对于f(n),若自然数对(x,y)满足 x+y=n,且gcd(x,y)=1,则这样的数对对数为f(n) 证明f(n)=phi(n) 设有命题 对任意自然数x满足x<n,gcd(x,n)=1等价于gcd(x,y)=1 成立,则该式显然成立,下面证明这个命题。 假设gcd(x,y)=1时,gcd(x,n)=...

2018-11-19 23:49:04 149

原创 CodeForces - 768F Barrels and boxes —— 组合数

题意: 有n个盛食物的箱子,m个盛酒的箱子,只有同种箱子能叠在一起,只有不同种的箱子能相邻摆放,问所有酒箱垒出的高度都大于h的概率 思路: 需要求出所有摆放的情况总数和满足条件的情况数 枚举酒箱的堆数i,即把m分成i个不为0的数,由隔板法,情况总数为C(m-1,i-1) 这时食物箱的摆放会出现三种情况 i-1堆时,情况总数为C(n-1,i-2) i堆时,情况总数为C(n-1,i-1)...

2018-11-18 23:04:30 83

转载 codeforces 399 E. Game of Stones 博弈 状压打表

题目地址 http://codeforces.com/contest/768/problem/E 题意 有1<=n<=1e61<=n<=1e6堆石子,每堆石子个数为1<=s<=601<=s<=60,每次选一堆石子,取走任意石子(不能为0),唯一的限制条件是对某堆石子,每次取走的石子数不能重复,当一方不能取走任意石子时,此方判输,问双方均采用最优策略...

2018-11-18 21:20:11 149

原创 E. Change-free贪心

E. Change-free Student Arseny likes to plan his life for n days ahead. He visits a canteen every day and he has already decided what he will order in each of the following n days. Prices in the cante...

2018-11-16 20:22:08 207

原创 E. Mahmoud and a xor trip 按位处理 异或 dp

Description Mahmoud and Ehab live in a country with n cities numbered from 1 to n and connected by n - 1 undirected roads. It's guaranteed that you can reach any city from any other using these roads...

2018-11-15 12:48:41 243 1

原创 CodeForces 763C. Timofey and remoduling

Little Timofey likes integers a lot. Unfortunately, he is very young and can't work with very big integers, so he does all the operations modulo his favorite prime m. Also, Timofey likes to look for a...

2018-11-13 16:40:53 216

原创 Codeforces Round #388 (Div. 2)D. Leaving Auction(set)

题意:有有许多人参加拍卖,问当假定某些人不参加的时候剩余的人当中谁是最终的赢家,输出他的编号和最终竞价,注:每个人都不能和自己竞价,即若某人连续竞价两次,以第一次价格为准。输入数据保证竞价递增。 思路: 我们只要把每个人竞价的最大值存起来, 并且把每个人的所有竞价维护在一个有序数组(方便二分), 对于一组询问,  我们从大到小遍历这k个数,把不在这k个数的最终竞价最大的两个人找到(复杂度O(K...

2018-11-01 22:30:15 140

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除