- 博客(149)
- 收藏
- 关注
原创 Gym_102823A Array Merge(贪心)
Array Mergetime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionGiven two arrays AAA, BBB of length n and m separately, you have to merge them into only one array CCC (of length n+mn+mn+m) obeying the rule that the relativ
2020-12-19 19:48:32
673
2
原创 CodeForces_1461E Water Level(数论 + 贪心)
Water Leveltime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionIn recent years John has very successfully settled at his new job at the office. But John doesn’t like to idly sit around while his code is compiling, so he i
2020-12-12 16:07:34
495
1
原创 Gym_102878E Eigen Substring(后缀自动机)
Eigen Substringtime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionFor any string sss, we define the substring s[l..r]s[l..r]s[l..r] an eigen substring of sss if and only if s[l..r]s[l..r]s[l..r] only appears once in sss.
2020-12-08 20:47:34
348
原创 CodeForces_1450C Errich-Tac-Toe(构造)
Errich-Tac-Toetime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionErrichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on Codeforces.In a Tic-Tac-Toe grid, there a
2020-12-07 13:13:57
372
原创 ZOJ_3199 Longest Repeated Substring(后缀数组+ST表)
Longest Repeated SubstringTime Limit: 5000 msMemory Limit: 32768 KBProblem DescriptionWrite a program that takes a string and returns length of the longest repeated substring. A repeated substring is a sequence of characters that is immediately followe
2020-12-06 18:03:26
143
原创 CodeForces_1456C New Game Plus!(贪心)
New Game Plus!time limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionWabbit is playing a game with n bosses numbered from 1 to n. The bosses can be fought in any order. Each boss needs to be defeated exactly once. There is a
2020-11-30 11:29:42
381
原创 洛谷_1382 楼房(线段树)
楼房题目链接:https://www.luogu.com.cn/problem/P1382题解:假设初始在点(-INF,0),那么之后的每次都可以看做一次水平移动加上一次垂直移动。类似于扫描线,将线段分为两部分,左端点为入,右端点为出。线段树维护最大值。将x坐标相同的作为一组。若当前点为左端点,则在线段树中加上h的信息,为右端点,则在线段树中删去h的信息。 最后求出当前h的最大值,即为yy, 此时的x轴坐标为xx。设上次移动后,点为(x,y)。若yy!=yyy!=yyy!=y,则在答案中加入(xx,
2020-11-15 20:40:25
276
原创 洛谷_2474 [SCOI2008]天平(差分约束)
[SCOI2008]天平题目链接:https://www.luogu.com.cn/problem/P2474题解:设dis1[i][j]dis1[i][j]dis1[i][j]代表j−i≤dis1[i][j]j-i\le dis1[i][j]j−i≤dis1[i][j], dis2[i][j]dis2[i][j]dis2[i][j]代表j−i≥dis2[i][j]j-i\ge dis2[i][j]j−i≥dis2[i][j]。初始化:若str[i][j] == ‘+’ , dis1[i][j]
2020-11-13 10:10:26
130
原创 POJ_2983 Is the Information Reliable?(差分约束)
Is the Information Reliable?Time Limit: 3000MS Memory Limit: 131072KProblem DescriptionThe galaxy war between the Empire Draco and the Commonwealth of Zibu broke out 3 years ago. Draco established a line of defense called Grot. Grot is a straight line
2020-11-06 15:03:24
157
原创 Gym_102452I Incoming Asteroids(数据结构)
Incoming Asteroidstime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionThe International Coalition to Prevent Catastrophes (ICPC) recently discovered several small asteroids in a nearby galaxy. If these asteroids hit the E
2020-10-31 10:17:48
723
原创 CodeForces_1437E Make It Increasing(动态规划)
Make It Increasingtime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given an array of n integers a1,a2,...,ana_1, a_2, ..., a_na1,a2,...,an, and aaa set bbb of kkk distinct integers from 111 to nnn.In one op
2020-10-28 13:34:33
563
原创 Gym_102028B Ultraman vs. Aodzilla and Bodzilla(贪心)
Ultraman vs. Aodzilla and Bodzilla time limit per test:2 secondsmemory limit per test:1024 megabytesProblem DescriptionSix months ago our hero, formerly known as Huriyyah, was beating all monsters in the land. Now he changed his name to Ultraman and le
2020-10-22 13:35:36
308
原创 HDU_6274 Master of Sequence(二分)
Master of SequenceTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionThere are two sequencesa1,a2,⋅⋅⋅,ana_1, a_2, · · · , a_na1,a2,⋅⋅⋅,an, b1,b2,⋅⋅⋅,bnb_1, b_2, · · · , b_nb1,b2,⋅⋅⋅,bn. Let S(t
2020-10-21 21:56:44
134
原创 Gym_101981M Mediocre String Problem(exkmp+manachar)
Mediocre String Problem time limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionGiven two strings s and t, count the number of tuples (i,j,k)(i, j, k)(i,j,k) such that1≤i≤j≤∣s∣1 ≤ i ≤ j ≤ |s|1≤i≤j≤∣s∣1≤k≤∣t∣.1 ≤ k ≤ |t|.1≤
2020-10-15 21:25:52
156
原创 CodeForces_1427D Unshuffling a Deck(构造)
Unshuffling a Decktime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given a deck of nnn cards numbered from 111 to nnn (not necessarily in this order in the deck). You have to sort the deck by repeating the foll
2020-10-11 09:15:02
599
原创 HDU_5381 The sum of gcd(数论+线段树)
The sum of gcdTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionYou have an array A,the length of AAA is nnnLet f(l,r)=∑i=lr∑j=ijgcd(ai,ai+1,...,aj)f(l,r)=\sum_{i=l}^r\sum_{j=i}^jgcd(a_i,a_{i+1},...,
2020-10-09 16:12:48
167
原创 CodeForces_1422D Returning Home(最短路)
Returning Hometime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYura has been walking for some time already and is planning to return home. He needs to get home as fast as possible. To do this, Yura can use the instant-
2020-10-05 18:14:11
806
1
原创 CodeForces_920G List Of Integers(二分+容斥)
List Of Integerstime limit per test:5 secondsmemory limit per test:256 megabytesProblem DescriptionLet’s denote as L(x, p)L(x, p)L(x, p) an infinite sequence of integers yyy such that gcd(p, y) = 1gcd(p, y) = 1gcd(p, y) = 1 and y > xy > xy > x
2020-10-01 10:38:22
153
原创 CodeForces_1419D Sage‘s Birthday(构造 + 贪心)
Sage’s Birthdaytime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionToday is Sage’s birthday, and she will go shopping to buy ice spheres. All nnn ice spheres are placed in a row and they are numbered from 111 to nnn from
2020-09-20 10:08:47
361
原创 POJ_3694 Network(并查集+DFS)
NetworkTime Limit: 5000MS Memory Limit: 65536KProblem DescriptionA network administrator manages a large network. The network consists of N computers and M links between pairs of computers. Any pair of computers are connected directly or indirectly by
2020-09-18 11:42:25
147
原创 HDU_5668 Circle(EXCRT)
CircleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionSatiya August is in charge of souls.He finds n souls,and lets them become a circle.He ordered them to play Joseph Games.The souls will count o
2020-09-17 12:00:46
103
1
原创 CodeForces_1418D Trash Problem(数据结构)
Trash Problemtime limit per test:3 secondsmemory limit per test:256 megabytesProblem DescriptionVova decided to clean his room. The room can be represented as the coordinate axis OX. There are n piles of trash in the room, coordinate of the iii-th pile
2020-09-15 11:31:00
211
原创 洛谷_1485 火枪打怪(二分+贪心)
火枪打怪题目链接:https://www.luogu.com.cn/problem/P1485题解:二分枚举p,判断能否满足题目要求即可。check:因为每颗子弹只会向左溅射,所以从右向左考虑每个怪物需要多少次攻击。在考虑当前状态时,需要减去怪物被子弹溅射所受的伤害。当第iii只怪物在攻击jjj时溅射范围内时,其受到的伤害为p−(i−j)2=p−i2−j2+2∗i∗jp-(i-j)^2 = p-i^2-j^2+2*i*jp−(i−j)2=p−i2−j2+2∗i∗j。其中p,ip,ip,i已知,统计攻
2020-09-11 16:41:04
336
原创 POJ_1990 MooFest(树状数组)
MooFestTime Limit: 1000MS Memory Limit: 30000KProblem DescriptionEvery year, Farmer John’s N (1 <= N <= 20,000) cows attend “MooFest”,a social gathering of cows from around the world. MooFest involves a variety of events including haybale stacki
2020-09-02 22:31:09
161
原创 CodeForces_1400E Clear the Multiset(分治)
Clear the Multisettime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou have a multiset containing several integers. Initially, it contains a1a_1a1 elements equal to 1, a2a_2a2 elements equal to 2, …, ana_nan element
2020-08-28 16:17:41
195
原创 ZOJ_3009 Spread Sheet(拓扑排序)
Spread SheetTime Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionIn 1979, Dan Bricklin and Bob Frankston wrote VisiCalc, the first spreadsheet application. It became a huge success and, at that time, was the killer application for the Apple II c
2020-08-19 19:06:06
213
原创 洛谷_2470 [SCOI2007]压缩
[SCOI2007]压缩题目链接:https://www.luogu.com.cn/problem/P2470题解:区间DP。设dp[i][j]dp[i][j]dp[i][j]代表字母iii前面有字母‘M’,字符串[i,j][i,j][i,j]子段压缩后的最短长度。递推式:dp[i][j]=min(dp[i][j],dp[i][k]+j−k)(i≤k<j)dp[i][j] = min(dp[i][j], dp[i][k]+j-k)(i\le k<j)dp[i][j]=min(dp[i]
2020-08-16 16:02:54
121
原创 HDU_3951 Coin Game(博弈)
Coin GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionAfter hh has learned how to play Nim game, he begins to try another coin game which seems much easier.The game goes like this:Two players s
2020-08-12 16:48:22
283
原创 CodeForces_590C Three States(BFS)
Three Statestime limit per test:5 secondsmemory limit per test:512 megabytesProblem DescriptionThe famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all me
2020-08-10 16:37:31
157
原创 CodeForces_1139D Steps to One(数论)
Steps to Onetime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionVivek initially has an empty array a and some integer constant m.He performs the following algorithm:Select a random integer x uniformly in range from 1 t
2020-08-04 20:40:09
269
原创 ZOJ_1918 Ferry Loading II(动态规划)
Ferry Loading IITime Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionBefore bridges were common, ferries were used to transport cars across rivers. River ferries, unlike their larger cousins, run on a guide line and are powered by the river’s cu
2020-07-31 23:41:12
230
原创 POJ_1011 Sticks(搜索)
SticksTime Limit: 1000MS Memory Limit: 10000KProblem DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many stick
2020-07-30 20:08:53
174
原创 ZOJ_1903 Jogging Trails(Floyd+DFS)
Jogging TrailsTime Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionGord is training for a marathon. Behind his house is a park with a large network of jogging trails connecting water stations. Gord wants to find the shortest jogging route that t
2020-07-28 20:20:17
239
原创 ZOJ_1901 A Star not a Tree?(模拟退火)
A Star not a Tree?Time Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionLuke wants to upgrade his home computer network from 10mbs to 100mbs. His existing network uses 10base2 (coaxial) cables that allow you to connect any number of computers tog
2020-07-27 18:26:26
180
原创 CodeForces_1381B Unmerge(动态规划)
Unmergetime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionLet aaa and bbb be two arrays of lengths nnn and mmm, respectively, with no elements in common. We can define a new array merge(a,b)(a,b)(a,b) of length n+mn+mn+m
2020-07-24 15:14:50
271
原创 CodeForces_1379C Choosing flowers(贪心)
Choosing flowerstime limit per test:1 secondsmemory limit per test:512 megabytesProblem DescriptionVladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly nnn flowers.Vladimir went to a flower sho
2020-07-21 18:08:38
470
原创 CodeForces_1385F Removing Leaves(贪心)
Removing Leavestime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given a tree (connected graph without cycles) consisting of nnn vertices. The tree is unrooted — it is just a connected undirected graph without c
2020-07-19 10:20:33
197
原创 ZOJ_3798 Abs Problem(构造)
Abs ProblemTime Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionAlice and Bob is playing a game, and this time the game is all about the absolute value!Alice has N different positive integers, and each number is not greater than N. Bob has a lo
2020-07-16 17:38:48
95
原创 ZOJ_3724 Delivery(线段树)
DeliveryTime Limit: 6000 msMemory Limit: 65536 KBProblem DescriptionKarl is an impatient guy. He always wants to find the fastest way to solve any problem. As a delivery man, it’s a very good personality because he can make the work more efficient.Now
2020-07-14 09:46:20
171
原创 CodeForces_1375E Sum of Digits(暴力+贪心)
Sum of Digitstime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionLet f(x)f(x)f(x) be the sum of digits of a decimal number x.Find the smallest non-negative integer xxx such that f(x)+f(x+1)+⋯+f(x+k)=nf(x)+f(x+1)+⋯+f(x+k)
2020-07-06 21:44:48
409
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人