abc's pan-d do

abc046d

Question is intended: to a stone, cloth sequence now requires that another sequence is greater than the number of stone and cloth obtained in each prefix number to win than lose the maximum number of times.

Ideas: because we seek greater than the number equal to the number of stone cloth, then be sure it is stone, cloth alternately.

abc047d

Meaning of the questions: to a sequence, from left to right to go now, you can sell or buy some apples in every place, price \ (a_i \) yuan. Asked to change some parts of the unit price can be reduced after the minimum maximum benefit needs to be changed.

Idea: Apple is certainly buy a lot somewhere, and then back to a place sold out. All the buy point if we are not able to get the maximum benefits are increased by 1, so you certainly can not succeed.

Then we scan forward from the back, then each place to find the back of the unit price minus the maximum current of each unit price as Apple's earnings, then the biggest gains were all increased by 1 point.

abc048d

Meaning of the title: a string to ask now if you delete some of the characters, so that no one can remove remaining after consecutive identical characters so that the character did not, and asked the number of characters parity deleted.

Ideas: First, if the head and tail are not equal, then we certainly can only do \ (abab \) such an outcome. The answer is the total number of parity. Otherwise, we are only able to do \ (aba \) this is the parity of the total number of reversal. (Ie, even odd change, even change odd)

Because we can across the two \ (a \) the number of occurrences of all the \ (b \) wholly outside deleted, leaving only the last of a \ (b \) .

abc049d

Meaning of the questions: to a pile of road, railway and pile asked for each point by road and rail with all points connected.

Thinking: get two disjoint-set, then the number of each (element blocks represent road communication, railway communication blocks represent membered) sorted into an array, so that two representatives of the same element, and it is in communication.

abc050d

The meaning of problems: Q n number of number in the \ ((a, b) \ ) makes \ ((u, v) \ ) such that \ (u \ \ text {xor } \ v = a, u + v = b \) .

Ideas: First, we play table, then you can come up with according to law \ (dp \) transfer equation:

\(dp(2n)=2dp(n)+dp(n-1)\)

\(dp(2n+1)=dp(n)+2dp(n-1)\)

Gone. Complexity \ (\ log (n) \ )

abc051d

Meaning of the questions: to a weighted undirected graph, ask a shortest side not in any way how much.

Thinking: My method is to put each edge prohibit re-run the shortest path, and then see whether a long length of enlargement of one of the most short-circuit the.

But this is the shortest for a bar for two routes is not enough.

So we have to go look directly from a b walk b_c this road is not equal to a shortest c enough.

abc052d

Meaning of the questions: to a bunch of points from the first point to ask now start to finish all the points of the minimum cost. Point B can be transmitted down to an arbitrary position, or the position of each point A down to spend a grid.

Ideas: We definitely go back to either a particular point, or transferred to there.

Then the weighting for each point \ (\ min (A (x_ {i + 1} -x_i), B) \) hot.

abc053d

Meaning of the questions: to count a pile, then three and now you want to delete a number of before and after the two, and then asked to delete the number to the number of the most different from each other most of the remaining.

Ideas: most of us left a number.

Then the number of deleted can be obtained.

Then we'll delete each and two, it shows that if we want to delete an odd number, then certainly have to kill more than a thing should be left behind.

abc054d

Meaning of the questions: to a bunch of items, there are two weight and value, whether the requirements can come up with some weight ratio \ (a: b \) , and the maximum value.

Ideas: direct backpack. Gone.

abc055d

The meaning of problems: some animals arranged in a circle, are the sheep and wolves, and now it around each animal species two animals are equal. The wolf lying, sheep certainly telling the truth.

What is now required for each animal yes.

Thinking: If we know what the first two are the animals, all animals are seeking out the back of the order.

So is the enumeration of the first two animals.

Then the third is based on a second animal sheep / wolves, about whether or equal to the launch.

Whether the animal until the last first established, (and whether a second animal in accordance with the first animal to say the establishment of) (and I'm not here to judge and hang).

abc056d

Meaning of the title: to number a bunch, now ask whether each number is the excess, if the excess is defined as the number of all inclusive, and more than \ (k \) the set out his or greater than \ (k \) .

Ideas: we know that the excess number is certainly a continuum from the minimum.

You can half. check when we do a backpack, if there can be greater than or equal \ (ka \) and less than \ (k \) and then it shows that he is not redundant.

abc057d

The meaning of problems: the number of pile to obtain the length of a \ (A \) to \ (B \) set such that the average between the maximum.

Ideas: first enumerates length, then we can find the largest average.

So our answer is the number of the number of the last digit of the number he really take take.

So even a pre-Cnm.

The last is a floating point error. WA me because this one point. (probably)

abc058d

Meaning of the questions: to a bunch of straight line parallel to the x-axis or y-axis, then the area of ​​each rectangle is now asked of us surrounded and.

Thinking: Push pile equation found only requires a small number of times per interval appears in all (i.e., the number of which comprises a section) of the product and, for the two axes xy process.

Then multiply the result of two axes can be.

abc059d

Meaning of the title: to number two, and asked each to come up with a number from the 2i, i put into another number, the last who can not move lose.

Ideas: If two numbers differ by only one, then losing the upper hand.

Because if we divide the part of large numbers to small, so that it will become a smaller sub-problems, then into the opponents two differ by one, from the past will become 01 this opponent win.

abc060d

Meaning of the questions: for some items, there are weight and value, all of which number no more than 3 weight difference now and then to ask how to take the weight of the goods does not exceed w, and the maximum value.

Thinking: Because of the difference in the weight of not more than 3, it can be by weight (the number of the total weight - number \ (\ Times \) minimum weight) FIG.

It can backpack.

Guess you like

Origin www.cnblogs.com/denverjin/p/10926436.html