自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 codeforces 1062F

传送门:https://codeforces.com/contest/1062/problem/F题意:给你一个有向无环图,问有多少点,他能到达的点数+能到他的点数>=n-1题解:能到达的就是正向图,能到他的就是反向图。因为是有向无环图,所以能到达的点和能到他的点的交集是空的。所以只要两幅图中有超过一个点不符合条件,那么这个点就不能被计算进答案里。用拓扑排序解决能到达的问...

2019-01-24 12:33:02 340 1

原创 codeforces 1062E

传送门:https://codeforces.com/contest/1062/problem/E题意:给你一棵树,每次询问[l,r]区间删掉一个点后,剩余的点的lca深度最大是多少,输出删除的点和lca深度。题解:首先一堆点的lca就是dfs序最大的点和最小的点的lca,那么我们只用考虑删掉这两个点后的lca是多少就可以了,维护区间dfs序最大和次大,最小和次小。#include&...

2019-01-24 12:02:51 246

原创 codeforces 1061D

传送门:https://codeforces.com/contest/1061/problem/D题意:给你n个节目,每个节目会在[l,r]区间播放,在[a,b]时间租一台电视需要花费x+y*(b-a),一台电视只能同时看一个节目,问最少需要多少钱能看所有节目。题解:贪心,先对节目从左到右排序,然后看当前是要租一台新的电视好还是旧的续租好。#include<bits/stdc+...

2019-01-24 10:35:24 366

原创 codeforces 156D

传送门:https://codeforces.com/contest/156/problem/D题意:给出一些联通块,加最少的边,使得这些连通块连通,问有多少种方案。题解:裸的矩阵树定理。#include<bits/stdc++.h>using namespace std;typedef long long ll;int fa[100005],num[100005]...

2019-01-22 12:01:25 190

原创 codeforces 1101D

传送门:https://codeforces.com/contest/1101/problem/D题意:求一条最长的链,链上所有点的gcd大于1。题解:维护每个点的每个质因子能向下延伸多少。#include<bits/stdc++.h>using namespace std;#define fi first#define se second#define mp m...

2019-01-21 14:30:14 339

原创 codeforces 1088E

传送门:https://codeforces.com/contest/1088/problem/E题意:给一棵树,找不超过n个联通块,彼此不相交,且权值总和除以联通块数量最大,如果有多解,要求联通块数量最多。题解:根据平均数可知,答案就是找出来有几个权值和最大的联通块,注意不要彼此覆盖。#include<bits/stdc++.h>using namespace std...

2019-01-21 13:57:04 162

原创 codeforces 1088D

传送门:https://codeforces.com/contest/1088/problem/D题意:每次询问(c,d),系统给出a^c和b^d的大小关系,在62次内求出a和b题解:从高位往低位询问,前面的都考虑为0。我们先询问当前这位是否相同,即当前位c和d都为1。如果两边的大小关系不变,那么就代表此位他们两个相同。接下来再询问一个(当前位为1,当前位为0)就可以确定此位是...

2019-01-21 13:54:15 553

原创 codeforces 1084E

传送门:http://codeforces.com/contest/1084/problem/E题意:给出两个字符串s,t,选出k个字符串,使得字典序在[s,t]内且前缀和不同的数量最多。题解:题目是询问构建一颗字典树,最左边不小于s,最右边不大于t,且结点个数最多,那么我们只要左边贴着s走,右边贴着t走即可,也就是如果当前左边不能走a右边不能走b的情况,我们要减掉相应的方案数。#i...

2019-01-18 11:27:01 187

原创 codeforces 1084D

传送门:http://codeforces.com/contest/1084/problem/D题意:给出一棵树,点为正权,边为负权,找出一条简单路径,权和最大。题解:我们定义g[i]代表以i结点为终点,从子树的点上来能获得的最大权值,那么同时要考虑i为转折点,那么只要在子树中找最大和次大的权和即可。#include<bits/stdc++.h>using namesp...

2019-01-18 11:22:34 219

原创 codeforces 1087F

传送门:http://codeforces.com/contest/1087/problem/F题意:一排有n个人玩石头剪刀布,每个人会出一个固定的手势,游戏会进行n-1轮,每次会随机挑选两个相邻的人比对,输的人退出,如果平局则随机一个人退出,问有多少人有可能获得最终冠军,还有q个修改操作,每次询问修改后可能获得冠军的人数。题解:假如一个人能获得冠军,那么他要都能赢左右两边的人,如果能打败...

2019-01-17 11:38:17 130

原创 codeforces 1087D

传送门:http://codeforces.com/contest/1087/problem/D题意:给你一棵树,为每条边分配实数非负实数边权,和为s,使得直径最小。题解:感性理解一下。。。只要把s平均分配到每个叶子节点的边即可。#include<bits/stdc++.h>using namespace std;int du[100005];int main(){...

2019-01-17 11:30:09 160

原创 codeforces 1100F

传送门:http://codeforces.com/contest/1099/problem/F题意:两个人在玩游戏。第一个人从根结点出发。每次可以选择往下走一个结点或者结束游戏返回根结点并选择性的吃结点上的饼干。第二个人在第一个人每次向下走之后可以选择一个当前节点的儿子节点ban掉。第一个人一定要在规定时间内返回到根结点,问最多能吃多少块饼干。题解:假设我们在t结...

2019-01-16 13:16:38 343

原创 codeforces 1099E

传送门:http://codeforces.com/contest/1099/problem/E题意:给你一个只包含AGCT的矩阵,让你用AGCT替换掉一些字符,使得每个2*2的子矩阵都包含AGCT,求替换掉最少字符的那个矩阵。题解:经过手动模拟发现,符合题意的矩阵,要么每行只有两种字符交替出现且与相邻行的字符不同,要么每列是上述这样,所以我们只要按行按列枚举,然后对于每行求出最优方案即可...

2019-01-16 13:10:26 421

原创 codeforces 1102F

传送门:http://codeforces.com/contest/1102/problem/F题意:给你一个n行m列的矩阵,你可以不限次数的交换任意两行形成一个新的矩阵,然后把这个矩阵的数按列写下来,使得任意两个相邻的差绝对值都大于等于k,求k的最大值。题解:n只有16,所以很容易想到状压dp,我们记录dp[i][j][k]在i状态下,头为j,尾为k的最大值,然后预处理任意两行放在一起的...

2019-01-16 13:07:32 905

原创 codeforces 1100F

传送门:http://codeforces.com/contest/1100/problem/F题意:n个数,q个询问,每次询问区间异或最大值。题解:普通的线段树会超时,我们考虑对每位有贡献的数最远是哪里,然后记录下来更新即可。#include<bits/stdc++.h>using namespace std;int b[500005],ans[500005];s...

2019-01-15 20:19:58 412

原创 codeforces 1100E

传送门:http://codeforces.com/contest/1100/problem/E题意:给出一个有向图,每条边的反转需要的控制器级别数,问最少需要多少级的控制器,反转一些边后使得这个图没有环。题解:首先肯定想到二分答案,如果当前二分后还有环,那么就是级别过低,检测是否有环可以用拓扑排序做到,如果没有环就说明这个级别可行,具体反转哪条边,只要可以反转的边在原来的拓扑序中是正确的...

2019-01-15 20:16:29 232

原创 codeforces 1100D

传送门:http://codeforces.com/contest/1100/problem/D交互题题意:在一个999*999的棋盘上,你有一个白骑士,每次可以向相邻的八个格子移动,对方有666个黑骑士,可以任意移动,如果在对方做出操作后,如果存在一个黑骑士和你的白骑士同行或者同列,那么你就赢了,现在请输出你的移动方案,系统给出对方的方案,输出一个必胜方案。题解:如果我们从当前位置扫...

2019-01-15 20:11:19 261

原创 牛客网暑期ACM多校训练营(第四场)A Ternary String

链接:https://www.nowcoder.com/acm/contest/142/A来源:牛客网 题目描述A ternary string is a sequence of digits, where each digit is either 0, 1, or 2.Chiaki has a ternary string s which can self-reproduce. E...

2018-07-29 14:02:43 301

原创 gym 100694 C

C. Modern Arttime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputSergey is a modern artist who uses 3D printer in his works. He has just come u...

2018-07-27 16:07:20 232

原创 gym 101512 A Avoiding the Apocalypse

链接:http://codeforces.com/gym/101512题意:有n个点,开始i点上有g个人每条路是a通向b,花费t秒,每秒可以通过t人有m个终点问在s秒内最多多少人到达终点 题解:对时间拆点即可 #include<cstdio> #include<cstring> #include<queue&g...

2018-07-20 20:20:21 258

原创 牛客网暑期ACM多校训练营(第一场)A Monotonic Matrix

链接:https://www.nowcoder.com/acm/contest/139/A来源:牛客网 题目描述Count the number of n x m matrices A satisfying the following condition modulo ().* Ai, j ∈ {0, 1, 2} for all 1 ≤ i ≤ n, 1 ≤ j ≤ m.* Ai,...

2018-07-20 10:56:46 432

原创 HDU 6161

Big binary treeTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionYou are given a complete binary tree with n nodes. The root node is n

2017-08-23 20:48:10 806

原创 NOIP 2016 费用流

飞扬的小鸟【问题描述】Flappy Bird是一款风靡一时的休闲手机游戏。玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙。如果小鸟一不小心撞到了水管或者掉在地上的话,便宣告失败。现在小鸟们遇到了一个难题,他们遇到了一堵巨大的墙,墙上仅有m个洞供他们通过,由于小鸟们的体型不同且墙上洞的形状也不同,所以每种体型的鸟通过每个洞的时间都

2017-08-23 18:54:52 489

原创 HDU 6050 Funny Function

Funny FunctionTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1215    Accepted Submission(s): 596Problem DescriptionFunction Fx,

2017-08-01 00:43:16 420 2

原创 HDU 6053 TrickGCD 数论

TrickGCDTime Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2532    Accepted Submission(s): 965Problem DescriptionYou are given an

2017-08-01 00:41:25 321

原创 HDU 6044 Limited Permutation 想法

Limited PermutationTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1714    Accepted Submission(s): 463Problem DescriptionAs to

2017-08-01 00:39:05 459

原创 HDU 6035 Colorful Tree

Colorful TreeTime Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2067    Accepted Submission(s): 881Problem DescriptionThere is a

2017-08-01 00:34:45 198

原创 HDU 6040 Hints of sd0061 stl

Hints of sd0061Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2301    Accepted Submission(s): 689Problem Descriptionsd0061, t

2017-08-01 00:31:28 360

原创 HOJ contests 15 J dp

Birthday PartyTime limit : 1 sMemory limit : 512 mb  64bit Integer Format : %lldProblem DescriptionMr. Frog's birthday party will be held to

2017-05-11 16:37:06 287

原创 HOJ contests 15 I

Beautiful GardenTime limit : 3 sMemory limit : 512 mb  64bit Integer Format : %lldProblem DescriptionLong long ago, there was a garden where

2017-05-10 19:06:53 203

原创 Codeforces gym 101102 K 想法

Topological Sorttime limit per test8 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider a directed graph G of N nodes a

2017-05-04 18:45:17 306

原创 Codeforces gym 101102 D 单调栈

Rectanglestime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an R×C grid with each cell containing an

2017-05-01 21:49:15 423

原创 Codeforces gym 101102 A dp

Coinstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHasan and Bahosain want to buy a new video game, they

2017-05-01 21:09:47 409

原创 Codeforces gym 101149 L 最短路

Right Buildtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn a MMORPG «Path of Exile» characters grow by

2017-04-30 18:26:40 614

原创 Codeforces gym 101149 K 想法

Revenge of the Dragontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne fairy king hated dragons to death

2017-04-30 18:20:47 521

原创 Codeforces gym 101149 G 想法

Of Zorcs and Axestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputZorcs don't like other species. Zorcs lik

2017-04-30 18:09:46 548

原创 Codeforces gym 101350G 数学

Snake Ranatime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOld Macdonald wants to build a new hen house for

2017-04-29 21:17:00 1088

原创 Codeforces gym 101350F 想法

Monkeying Aroundtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen the monkey professor leaves his class

2017-04-29 21:10:07 1144 2

原创 Codeforces gym 101350A dp

Sherlock Bonestime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe great dog detective Sherlock Bones is

2017-04-29 21:04:48 835

原创 Codeforces 798D 构造

Mike and distributiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has always been thinking about t

2017-04-24 19:58:42 301

空空如也

空空如也

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

TA关注的人

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