自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

孤风的博客

路漫漫兮

  • 博客(45)
  • 收藏
  • 关注

原创 牛客-紫魔法师(仙人掌染色-判奇环)

题目链接:https://ac.nowcoder.com/acm/contest/7016/F博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13530156.html题目描述“サーヴァント、キャスター、Medea。”–紫魔法师给出一棵仙人掌(每条边最多被包含于一个环,无自环,无重边,保证连通),要求用最少的颜色对其顶点染色,满足每条边两个端点的颜色不同,输出最小颜色数即可输入描述:第一行包括两个整数n,m,表示顶点数和边数n<=100000

2020-08-19 16:37:28 450 1

原创 牛客编程巅峰赛S1第12场 王者C-椭圆曲线(快速乘的运用)

题目链接:https://ac.nowcoder.com/acm/contest/6916/C博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13512283.html题目描述椭圆曲线加密算法是在椭圆曲线有限域上进行加密的算法,一般的椭圆曲线为Ep(a,b):y2=x3+ax+bE_{p}(a,b): y^2=x^3+ax+bEp​(a,b):y2=x3+ax+b,其中p为质数。椭圆曲线上的点的运算满足以下规则:1.曲线上A、B不同两点相加,过A、B两

2020-08-16 13:32:18 583

原创 牛客编程巅峰赛S1第12场 王者B-上上下下(DP)

题目链接:https://ac.nowcoder.com/acm/contest/6916/B博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13512246.html题目描述牛牛是一位优秀的程序员。最近,牛牛在的公司要办年会了。牛牛所在的组要表演一个比较有意思的大合唱,程序员们站在第一排,产品经理们站在第二排。为了让年会节目更有吸引力,牛牛在设计站位上下了功夫:从左往右,程序员们由高到矮进行站位,而产品经理们则按由矮到高进行站位,两个队列的上下场方向也

2020-08-16 13:20:57 444

原创 牛客编程巅峰赛S1第12场 王者A-锻炼身体(树上追击问题)

题目链接:https://ac.nowcoder.com/acm/contest/6916/A博客园食用链接: https://www.cnblogs.com/lonely-wind-/p/13512212.html题意疫情期间,牛牛整天摊在床上沉溺于手机,身体日渐虚胖,因此牛妹拿走家中的 wifi 路由器,迫使牛牛下床来拿到路由器。在这过程中,牛牛想要在尽可能短的时间内拿到路由器,而牛妹却希望牛牛多走一会儿。现假设牛妹家中有 n 个房间,任意两个房间有且仅有一条路径,起初路由器在编号为 x 的房间内

2020-08-16 13:08:56 363

原创 CSUSTOJ 1127-区间方差(线段树)

题目链接:http://acm.csust.edu.cn/problem/1127博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13509886.htmlDescription线段树进阶题n个数m次操作1 pos x 将位置为pos的值修改为x2 l r 查询区间l,r的方差乘以区间长度的平方Input输入:第一行,n,m接下来一行n个数接下来m行操作1 pos x2 l r(1≤n,m≤216)(0≤

2020-08-15 18:58:02 393

原创 Codeforces 1398C- Good Subarrays(区间值为0的个数变形-思维)

题目链接:https://codeforces.com/problemset/problem/1398/C博客园食用链接: https://www.cnblogs.com/lonely-wind-/p/13509265.htmlYou are given an array a1,a2,…,ana_1,a_2,…,a_na1​,a2​,…,an​ consisting of integers from 0 to 9. A subarray al,al+1,al+2,…,ar−1a_l,a_{l+1},a_

2020-08-15 16:38:06 587 1

原创 CSUSTOJ 4000-你真的会数据结构吗?(状压+素数分解)

题目链接:http://acm.csust.edu.cn/problem/4000博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13509092.htmlDescription现在给你一棵有n个结点的有根树,根为结点1,每个结点有点权aia_iai​现有q次询问:type 1:1 u xtype\ 1: 1\ u\ xtype 1:1 u x表示将uu结点的点权修改为x;type&nbsp

2020-08-15 16:02:49 300

原创 牛客练习赛67 F-牛妹的苹果树(树上最远点对/区间带权直径-线段树+LCA)

题目链接:https://ac.nowcoder.com/acm/contest/6885/F博客园食用链接:题目描述牛妹种了一棵苹果树。这棵苹果树有n个节点,n-1条边,每一条边都有一个权值wiw_iwi​我们定义:这棵树上的两点之间距离dist(u,v)dist(u,v)dist(u,v)为它们简单路径上所有边的权值和。现在,牛妹想给你q次询问,每次询问一个区间[l,r],求max(dist(u,v)),l≤u≤v≤rmax(dist(u,v)),l\le u\le v\le rmax(dis

2020-08-15 14:21:35 409

原创 牛客练习赛67 E-牛妹游历城市(拆位最短路)

题目链接:https://ac.nowcoder.com/acm/contest/6885/E博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13507992.html题目描述最近,牛妹天天宅在家里,真是憋死人了。他决定出去旅游。牛妹现在正在1号点(自己家里),他决定前往n号点(牛妹想去的地方),中途可以多次经过1~n号点。现在,已知每个点都有个权值aia_iai​,如果ai&aj≠0a_i \& a_j ≠0ai​&aj​​

2020-08-15 11:24:39 371

原创 牛客练习赛67 D-牛牛爱数列(DP)

题目链接:https://ac.nowcoder.com/acm/contest/6885/D博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13507947.html题目描述牛妹正在玩一个数列他手里有一个长度为n的序列a,保证它是一个01序列,并执行以下两种操作:1.单点修改:将位置x上的数翻转(0变1,1变0);2.前缀修改:将位置1~x上的数翻转(每个数都0变1,1变0)。他现在想要最小化翻转次数,使得数列上的所有数都变为0。输入描述:第

2020-08-15 11:13:16 455

原创 牛客练习赛67 C-牛牛爱博弈(SG打表)

题目链接:https://ac.nowcoder.com/acm/contest/6885/C博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13507910.html题目描述牛牛和牛妹玩博弈游戏。牛牛:我们来玩取石子游戏。一共有n堆石子,每个人每次可以取1或2颗石子,谁取走了最后一颗石子就算谁获胜。牛妹:这游戏太无聊了。牛牛:那改一改。一共有n堆石子,每个人每次可以取1,2,4,8,...2k1,2,4,8,...2^k1,2,4,8,...2k颗

2020-08-15 11:05:12 420

原创 牛客练习赛67 A-牛牛爱字符串(字符串小模拟)

题目链接:https://ac.nowcoder.com/acm/contest/6885/A博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13507875.html题目描述牛牛在玩字符串。牛牛得到了一个字符串(可能含有空格),他希望在这些字符串中提取出数字。例如:a1b23c456d007890中可以提取出1, 23, 456, 7890共4个数字。现在,他得到了一个长度高达1000的字符串,请你帮他提取出所有的数字。输入描述:本题有多组数据

2020-08-15 10:54:24 860

原创 2020杭电HDU-6863多校第八场Isomorphic Strings(Hash+学到的新东西)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6863博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13498870.htmlProblem DescriptionIt is preferrable to read the pdf statment.Two strings are called cyclical isomorphic if one can rotate one string to get

2020-08-13 21:19:43 852 2

原创 CodeForces 1395C-Boboniu and Bit Operations(位运算-暴力)

题目链接:https://codeforces.com/problemset/problem/1395/C博客园食用链接: https://www.cnblogs.com/lonely-wind-/p/13494811.htmlBoboniu likes bit operations. He wants to play a game with you.Boboniu gives you two sequences of non-negative integers a1,a2,…,ana_1,a_2,…

2020-08-13 10:14:21 738

原创 洛谷P2585&ZJOI 2006-三色二叉树(树的染色-树形DP)

题目链接:https://www.luogu.com.cn/problem/P2585博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13492758.html题目描述一棵二叉树可以按照如下规则表示成一个由0,1,2组成的字符序列,我们称之为“二叉树序列S”:S={0表示该树没有子节点1S1表示该树有一个子节点,S1为其子树的二叉树序列2S1S2表示该树由两个子节点,S1和S2分别表示其两个子树的二叉树序列S=\left\{\begin{matrix}

2020-08-12 20:20:40 1114

原创 洛谷P2016-战略游戏(树的最小点覆盖-树形DP)

题目链接:https://www.luogu.com.cn/problem/P2016博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13491175.html题目背景Bob 喜欢玩电脑游戏,特别是战略游戏。但是他经常无法找到快速玩过游戏的办法。现在他有个问题。题目描述他要建立一个古城堡,城堡中的路形成一棵无根树。他要在这棵树的结点上放置最少数目的士兵,使得这些士兵能了望到所有的路。注意,某个士兵在一个结点上时,与该结点相连的所有边将都可以被了望到。

2020-08-12 16:13:34 461

原创 洛谷P2015-二叉苹果树(树形DP)

题目链接:https://www.luogu.com.cn/problem/P2015博客园食用链接:题目描述有一棵苹果树,如果树枝有分叉,一定是分2叉(就是说没有只有1个儿子的结点)这棵树共有N个结点(叶子点或者树枝分叉点),编号为1-N,树根编号一定是1。我们用一根树枝两端连接的结点的编号来描述一根树枝的位置。下面是一颗有4个树枝的树2 5\ /3 4\ /1现在这颗树枝条太多了,需要剪枝。但是一些树枝上长有苹果。给定需要保留的树枝数量,求出最多能留住多少苹果。输入格式

2020-08-12 11:10:09 403

原创 洛谷P1352-没有上司的舞会(树形DP)

题目链接:https://www.luogu.com.cn/problem/P1352博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13488159.html题目描述某大学有 n 个职员,编号为 1…n1\ldots n1…n。他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司。现在有个周年庆宴会,宴会每邀请来一个职员都会增加一定的快乐指数 rir_iri​,但是呢,如果某个职员的直接上司来参加舞会了,那么这个职

2020-08-11 23:54:38 1409

原创 CSUSTOJ 4004-你真的会吃零食吗?(打表)

题目链接:http://acm.csust.edu.cn/problem/4004博客园食用链接:Description有n个人分一堆零食,第一个人扔掉一包零食后刚好能均分成n等份,然后他取走了自己的一份;第二个人再第一个人剩下零食的基础上做相同的操作,扔掉一包然后分成n等份;后面的人也这样做。问最少有多少个零食可以支持n个人这样分配。Input输入一行一个整数n.2≤n≤92\le n\le 92≤n≤9Output一行一个整数表示答案。Sample Input 12Sample

2020-08-11 23:22:26 975 3

原创 2020杭电HDU-6852多校第七场Increasing and Decreasing(构造+思维模拟)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6852博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13485238.htmlNotice:Don’t output extra spaces at the end of one line.Given n,x,y, please construct a permutation of length n, satisfying that:The length

2020-08-11 21:22:14 409 1

原创 Gym 102218D-Dynamic Network(倍增实现强制在线动态LCA)

题目链接:https://codeforces.com/gym/102218/problem/D博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13483279.htmlRecently, a startup by a group of students has become more popular and there are plans for expanded offices. Bryan got an internship in this compa

2020-08-11 20:53:52 457

原创 2020牛客暑期多校第二场E-Exclusive OR(FWT)

博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13474701.html题目大意:给你n个数,ai(0≤ai<218)a_i(0\leq a_i<2^{18})ai​(0≤ai​<218),你现在需要选出其中1,2,3,....n1,2,3,....n1,2,3,....n个数,使得其a1⨁a2⨁...⨁aia_1\bigoplus a_2\bigoplus ...\bigoplus a_ia1​⨁a2​⨁...⨁ai​的值最大。1≤n≤2

2020-08-11 11:55:52 302

原创 洛谷P4717-快速沃尔什变换/FWT(FWT板子题)

题目链接:https://www.luogu.com.cn/problem/P4717博客园食用链接:题目描述给定长度为2n2^n2n两个序列A,BA,BA,B,设Ci=∑jk=iAj×BkC_i=\sum_{jk=i}A_j\times B_kCi​=∑jk=i​Aj​×Bk​

2020-08-10 23:12:49 369

原创 2020杭电HDU-6831多校第六场Fragrant numbers(区间DP打表)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6831博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13461891.htmlProblem DescriptionMany people love numbers, and some have a penchant for specific numbers. Nowadays in popular culture, 114514191911451419191

2020-08-09 10:44:55 444

原创 Gym 102219H-Are You Safe?(凸包求解+判断点与凸包关系)

题目链接:https://codeforces.com/gym/102219/problem/H博客园食用链接:Recently, the nation was shocked by news of Sungai Kim Kim incident in Pasir Gudang, Johor, which has been polluted by chemical waste. Thousands of people who are affected had experienced nausea, di

2020-08-08 20:06:56 708

原创 2020杭电HDU-6827多校第六场Road To The 3rd Building(找规律求期望)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6827博客园食用链接:Problem DescriptionBecause of the thriller adventure game The 3rd Building, there are fewer and fewer students who would like to go to the 3rd Building. So few students are working in the studio

2020-08-08 10:52:12 631 1

原创 洛谷P1099&Noip 2007提高-树网的核(树直径上的尺取)

题目链接:https://www.luogu.com.cn/problem/P1099博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13456497.html题目描述设 T=(V,E,W)T=(V,E,W)T=(V,E,W) 是一个无圈且连通的无向图(也称为无根树),每条边到有正整数的权,我们称 TTT 为树网(treenetwork),其中 VVV,EEE 分别表示结点与边的集合,WWW 表示各边长度的集合,并设 TTT 有 nnn 个结点。路径:树

2020-08-08 09:46:55 519

原创 2020杭电HDU-6832多校第六场A Very Easy Graph Problem(最短路转最小生成树+dfs)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6832博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13455277.htmlAn undirected connected graph has n nodes and m edges, The i-th edge’s length is 2i2^i2i. Each node i has a value aia_iai​, which is either 0 o

2020-08-07 21:12:54 472

原创 CodeForces 950D-A Leapfrog in the Array(打表找规律)

题目链接:https://codeforces.com/problemset/problem/950/D博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13454001.htmlDima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every

2020-08-07 17:10:58 340

原创 Codeforces 950C-Zebras(模拟构造)

题目链接:https://codeforces.com/problemset/problem/950/C博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13453216.htmlOleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a ze

2020-08-07 15:35:01 330

原创 CodeForces 954D-Fight Against Traffic(加边最短路)

题目链接:https://codeforces.com/problemset/problem/954/D博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13451829.htmlLittle town Nsk consists of n junctions connected by m bidirectional roads. Each road connects two distinct junctions and no two roads connect

2020-08-07 11:43:30 648

原创 Codeforces 954C- Matrix Walk(思维+构造)

题目链接:https://codeforces.com/problemset/problem/954/C博客园食用链接: https://www.cnblogs.com/lonely-wind-/p/13450882.htmlThere is a matrix A of size x × y filled with integers. For every i∈[1,x],j∈[1,y]i\in[1,x],j\in[1,y]i∈[1,x],j∈[1,y] , Ai, j = y(i − 1) + jA_

2020-08-07 09:52:16 331

原创 2020杭电HDU-6836多校第六场Expectation(拆位矩阵树及其注意事项)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6836博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13449312.htmlYou are given an undirected graph consisting of n vertices with m weighted edges. We define the weight of a spanning tree as the bitwise AND of

2020-08-06 21:57:30 534

原创 Codeforces 595C-Warrior and Archer(思维博弈)

题目链接:https://codeforces.com/problemset/problem/595/C博客园食用链接: https://www.cnblogs.com/lonely-wind-/p/13444856.htmlIn the official contest this problem has a different statement, for which jury’s solution was working incorrectly, and for this reason it was

2020-08-06 10:52:00 423

原创 CodeForces 592C-Warrior and Archer(数论+python写法)

题目链接:https://codeforces.com/problemset/problem/592/C博客园食用链接: https://www.cnblogs.com/lonely-wind-/p/13444300.htmlVector Willman and Array Bolt are the two most famous athletes of Byteforces. They are going to compete in a race with a distance of L meters

2020-08-06 09:34:13 338

原创 CodeForces 592D-Super M(树上生成树+树的直径之树DP的缺点)

题目链接:https://codeforces.com/problemset/problem/592/D博客园食用链接:Ari the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforces’ superhero. Byteforces is a country that consists of n cities, connected by n - 1 bidirectional

2020-08-06 09:10:04 368

原创 CSUST 4005-你真的会!(分治思维+线段树)

题目链接:http://acm.csust.edu.cn/problem/4005博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13440076.htmlDescription给一个长度nnn的序列aia_iai​ 要进行¥m$次操作,共有三种操作:1.(L  R  V)1.(L\;R\;V)1.(LRV) 表示区间[L,R][L,R][L,R]数值覆盖为VVV;2.(P  V)2.(P\;V)2.(PV)表示apa_pap​ 数值赋值为VVV;3

2020-08-05 15:19:17 364

原创 CSUST 4007-你真的会图论吗?(思维-三元环)

题目链接:http://acm.csust.edu.cn/problem/4007博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13439655.htmlDescription给你一张完全无向图,每条边有两种颜色(黑色或者白色),你需要求出有多少个三元环,路径上边的颜色相同给你一张完全无向图,每条边有两种颜色(黑色或者白色),你需要求出有多少个三元环,路径上边的颜色相同Input第一行一个正整数nnn,表示这张完全图的点数.(1≤n≤5e3)(1 \

2020-08-05 14:34:25 563

原创 CSUST 4002-你真的会字符串吗?(DP)

题目链接:http://acm.csust.edu.cn/problem/4002博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13437112.htmlDescription对于一个正整数S,我们可以看成 S={sn,sn−1,......,si,......s1}S = \{s_n,s_{n-1},......,s_i,......s_1\}S={sn​,sn−1​,......,si​,......s1​},其中si=⌊S10i−1⌋mod  &n

2020-08-04 23:41:00 360

原创 CSUST 4006-你真的会树套树套树吗?(贪心|dp)

题目链接:http://acm.csust.edu.cn/problem/4006博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13436097.htmlDescriptiongaygaygay 黄和 gaygaygay 行在一次探险过程中,获得了 nnn 颗宝石,第 iii 颗宝石有 a[i]a[i]a[i] 的价值。为了公平起见,他们决定要尽可能的使得他们 222 个人所获得的宝石价值尽可能的接近。但是他们有点懒,想让学弟学妹们帮帮他们,给他们一

2020-08-04 21:36:19 365 2

空空如也

空空如也

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

TA关注的人

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