- 博客(131)
- 收藏
- 关注
原创 HDU - 6315 E - Naive Operations (乱搞线段树)
In a galaxy far, far away, there are two integer sequence a and b of length n.b is a static permutation of 1 to n. Initially a is filled with zeroes.There are two kind of operations:1. add l r: add one foral,al+1...aral,al+1...ar2. query l r: quer...
2020-08-26 17:52:29
208
原创 P3806 【模板】点分治 (模板)
题目背景感谢 hzwer 的点分治互测。题目描述给定一棵有nn个点的树,询问树上距离为kk的点对是否存在。输入格式第一行两个数n,mn,m。第22到第nn行,每行三个整数u, v, wu,v,w,代表树上存在一条连接uu和vv边权为ww的路径。接下来mm行,每行一个整数kk,代表一次询问。输出格式对于每次询问输出一行一个字符串代表答案,存在输出AYE,否则输出NAY。输入输出样例输入 #1复制2 11 2 22...
2020-08-20 10:30:48
182
原创 HDU - 6832 F - A Very Easy Graph Problem dfs + 并查集
An undirected connected graph hasnnnodes andmmedges, Theii-th edge’s length is2i2i. Each nodeiihas a valueaiai, which is either00or11. You need to calculate:∑i=1n∑j=1nd(i,j)×[ai=1∧aj=0]∑i=1n∑j=1nd(i,j)×[ai=1∧aj=0]d(i,j)d(i,j)indicates th...
2020-08-14 17:11:08
193
原创 HDU - 6805 D - Deliver the Cake
It is Zhang3's birthday! Zhang3 has bought a birthday cake and now it's time to take it home.There arennvillages, labeled1,2,…,n1,2,…,n. There aremmbidirectional roads, theithithof which connects villageaiai,bibiand it isdidimeter(s) long.T...
2020-08-12 11:43:38
159
原创 2020暑假牛客多校第九场 K The Flee Plan of Groundhog (DFS)
Groundhog was especially careful after the outbreak,so he put on his mask in the1^{st}1stbedroom early,and then walked on the way to the{n^{th}}nthdormitory to play with Orange.There are{n}ndormitories in ZLZX, which are connected by{n-1}n−1corrid...
2020-08-09 12:01:38
256
原创 Codeforces Round #662 (Div. 2) C. Pinkie Pie Eats Patty-cakes 贪心 + 二分
C. Pinkie Pie Eats Patty-cakestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cak
2020-08-08 10:00:12
336
原创 HDU - 6183 Color it (动态开点权值线段树)
Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to maintain following operations. The specific format of thes
2020-08-05 11:10:59
199
原创 2020 Multi-University Training Contest 1 Leading Robots 单调栈
Sandy likes to play with robots. He is going to organize a running competition between his robots. And he is going to give some presents to the winners. Robots are arranged in a line. They have their initial position (distance from the start line) and acce
2020-07-29 23:11:35
198
原创 2020牛客多校第三场 Operating on a Graph
You are given a graph containing n vertices and m edges. Vertices are numbered from0ton-1. Initially, vertexibelongs to groupi. We define a groupAis connected to groupBif and only if there exists at least an edge that connects the two vertices wh...
2020-07-28 13:39:54
260
原创 HDU - 2669 Romantic 拓展欧几里得(裸题)
The Sky is Sprite.The Birds is Fly in the Sky.The Wind is Wonderful.Blew Throw the TreesTrees are Shaking, Leaves are Falling.Lovers Walk passing, and so are You.................................Write in English class by yifenfeiGirls are cle...
2020-07-18 23:47:43
264
原创 Codeforces Round #652 (Div. 2) D. TediousLee
D. TediousLeetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLee tried so hard to make a good div.2 D problem to balance his recent contest, but it still doesn't feel good at all. Lee
2020-07-11 18:32:31
172
原创 poj3208 Apocalypse Someday (数位dp + 二分)
The number 666 is considered to be the occult “number of the beast” and is a well used number in all major apocalypse themed blockbuster movies. However the number 666 can’t always be used in the scri...
2020-04-22 12:48:30
195
原创 HDU - 3065 病毒侵袭持续中
小t非常感谢大家帮忙解决了他的上一个问题。然而病毒侵袭持续中。在小t的不懈努力下,他发现了网路中的“万恶之源”。这是一个庞大的病毒网站,他有着好多好多的病毒,但是这个网站包含的病毒很奇怪,这些病毒的特征码很短,而且只包含“英文大写字符”。当然小t好想好想为民除害,但是小t从来不打没有准备的战争。知己知彼,百战不殆,小t首先要做的是知道这个病毒网站特征:包含多少不同的病毒,每种病毒出现了多少次。大家...
2020-04-21 17:26:54
168
原创 HDU - 2896 病毒侵袭
当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他决定要把世界上所有带病毒的网站都找出来。当然,谁都知道这是不可能的。小t却执意要完成这不能的任务,他说:...
2020-04-21 16:55:00
211
原创 HDU - 5687 H - Problem C (删除操作字典树)
度熊手上有一本神奇的字典,你可以在它里面做如下三个操作:1、insert : 往神奇字典中插入一个单词2、delete: 在神奇字典中删除所有前缀等于给定字符串的单词3、search: 查询是否在神奇字典中有一个字符串的前缀等于给定的字符串Input这里仅有一组测试数据。第一行输入一个正整数N(1≤N≤100000)N(1≤N≤100000),代表度熊对于字典的操...
2020-04-20 23:43:34
138
原创 UVA - 10282 Babelfish
就是一个用map搞一搞的题目的是学到了sscanf的用法贴一下学习的博客https://blog.youkuaiyun.com/weixin_41190227/article/details/86506115?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158737436819724843313629%2522%252C%2522s...
2020-04-20 17:35:55
153
原创 HDU - 4612 Warm up (tarjan缩点 + 树形dp)
N planets are connected by M bidirectional channels that allow instant transportation. It's always possible to travel between any two planets through these channels. If we can isolate some planets ...
2020-04-01 22:26:21
164
原创 HDU - 4738 Caocao's Bridges (tarjan找桥)
在赤壁之战中,曹操被诸葛亮和周瑜击败。但他不会放弃。曹操的军队仍然不善于水战,所以他提出了另一个想法。他在长江建造了许多岛屿,在这些岛屿的基础上,曹操的军队很容易攻击周瑜的部队。曹操还建造了连接岛屿的桥梁。如果所有岛屿都通过桥梁相连,那么曹操的军队可以在这些岛屿中非常方便地部署。周瑜无法忍受,所以他想要摧毁一些曹操的桥梁,这样一个或多个岛屿就会与其他岛屿分开。但周瑜只有一枚由诸葛亮留下的炸弹,所...
2020-03-31 21:57:37
221
原创 ZOJ - 3261 I - Connections in Galaxy War
Connections in Galaxy WarZOJ - 3261In order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages. However, when the G...
2020-03-24 22:19:46
131
原创 CodeForces - 1325C Ehab and Path-etic MEXs
You are given a tree consisting ofnnnodes. You want to write some labels on the tree's edges such that the following conditions hold:Every label is an integer between00andn−2n−2inclusive. All...
2020-03-17 15:33:40
289
2
原创 HDU - 2476 D - String painter 区间dp
There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change a segment of chara...
2020-03-15 22:16:07
162
原创 CodeForces - 1312E Array Shrinking 区间dp
You are given an arraya1,a2,…,ana1,a2,…,an. You can perform the following operation any number of times:Choose a pair of two neighboring equal elementsai=ai+1ai=ai+1(if there is at least one such...
2020-03-15 12:09:47
210
原创 Distance Gym - 102028I 2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest
There arennpoints on a horizontal line, labelled with11throughnnfrom left to right.The distance between theii-th point and the(i+1)(i+1)-th point isaiai.For each integerkkranged from11...
2020-03-13 17:54:30
102
原创 洛谷P4742 [Wind Festival]Running In The Sky DAG dp + tarjan缩点
题目背景[Night - 20:02[Night−20:02P.M.]P.M.]夜空真美啊……但是……快要结束了呢……题目描述一天的活动过后,所有学生都停下来欣赏夜空下点亮的风筝。CurtisCurtisNishikinoNishikino想要以更近的视角感受一下,所以她跑到空中的风筝上去了(这对于一个妹子来说有点匪夷所思)! 每只风筝上的灯光都有一个亮度k_iki. 由于...
2020-03-11 18:18:50
168
原创 P1073 最优贸易 DAG dp入门
题目描述C国有n个大城市和m条道路,每条道路连接这n个城市中的某两个城市。任意两个城市之间最多只有一条道路直接相连。这m条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也计为1条。C国幅员辽阔,各地的资源分布情况各不相同,这就导致了同一种商品在不同城市的价格不一定相同。但是,同一种商品在同一个城市的买入价和卖出价始终是相同的。商人阿龙来到C国...
2020-03-10 18:35:02
190
原创 CodeForces - 1323C C - Unusual Competitions
A bracketed sequence is called correct (regular) if by inserting "+" and "1" you can get a well-formed mathematical expression from it. For example, sequences "(())()", "()" and "(()(()))" are correct...
2020-03-09 21:10:54
153
原创 CodeForces - 1321D D - Navigation System (最短路问题)
The map of Bertown can be represented as a set ofnnintersections, numbered from11tonnand connected bymmone-way roads. It is possible to move along the roads from any intersection to any other ...
2020-03-04 11:55:56
304
原创 CodeForces - 1305B B - Kuroni and Simple Strings
Now that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wa...
2020-03-04 11:54:05
243
原创 CodeForces - 1315B Homecoming
After a long party Petya decided to return home, but he turned out to be at the opposite end of the town from his home. There arenncrossroads in the line in the town, and there is either the bus or ...
2020-02-24 21:00:55
659
原创 牛客小白月赛22 B 树上子链(树形dp)
示例1输入复制52 -1 -1 -2 31 22 32 42 5输出复制4说明样例中最大子链为1 -> 2 -> 5备注:一个结点,也可以称作一条链好久没写树形dp了场上这么简单的树形dp都没写出来#include<bits/stdc++.h>#define ll long longc...
2020-02-23 13:12:27
213
原创 ZOJ - 3946 Highway Project
Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus, he proposed the highway project.The...
2020-02-21 21:53:56
109
原创 CodeForces - 1307C C - Cow and Message
Bessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure that there is a secret message hidden inside.The text is a stringssof lowercase Latin lett...
2020-02-18 21:03:24
323
原创 CodeForces - 1307B B - Cow and Friend
Bessie has way too many friends because she is everyone's favorite cow! Her new friend Rabbit is trying to hop over so they can play!More specifically, he wants to get from(0,0)(0,0)to(x,0)(x,0)...
2020-02-18 21:02:06
344
原创 CodeForces - 1307A A - Cow and Haybales
The USA Construction Operation (USACO) recently ordered Farmer John to arrangea rowofnnhaybale piles on the farm. Theii-th pile containsaiaihaybales.However, Farmer John has just left for vac...
2020-02-18 20:59:33
543
原创 CodeForces - 1304E H - 1-Trees and Queries (LCA)
Gildong was hiking a mountain, walking by millions of trees. Inspired by them, he suddenly came up with an interesting idea for trees in data structures:What if we add another edge in a tree?Then h...
2020-02-17 10:41:26
315
原创 CodeForces - 1304D G - Shortest and Longest LIS (构造 + sort)
D. Shortest and Longest LIStime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGildong recently learned how to find thelongest incr...
2020-02-16 22:16:24
202
原创 CodeForces - 1304B E - Longest Palindrome
Returning back to problem solving, Gildong is now studying about palindromes. He learned that apalindromeis a string that is the same as its reverse. For example, strings "pop", "noon", "x", and "kk...
2020-02-16 21:32:49
352
原创 CodeForces - 1304C F - Air Conditioner
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.Gildong tries so hard to satisfy the customers that he even me...
2020-02-16 18:26:07
196
原创 CodeForces - 1301B B - Motarack's Birthday
Dark is going to attend Motarack's birthday. Dark decided that the gift he is going to give to Motarack is an arrayaaofnnnon-negative integers.Dark created that array10001000years ago, so some...
2020-02-16 17:47:10
359
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人