Codeforces Round #570 (Div. 3)

A

And the median for the \ (4 \) multiple, related to carry directly to the nearest \ (30 \) a judgment about enough

B

The maximum possible is: minimum \ (k + \) , if the maximum value can \ (≤ \) This value is established, otherwise the output \ (--1 \)

C

First of all election \ (b \) , to see if positive, considering the positive part to this election \ (A \) , equivalent to fill out how many \ (ab \)

D

There is an obvious pit is not the whole point of the assignment, most \ (t \) away, are the reason

We count the number of each color, thrown into the sorted array a single, descending considering traversal, each priority takes a maximum value satisfies the conditions

Specific implementation is to take a maximum value can be chosen record pointer, if the pointer just traversed value is selected, the pointer is left; if more than a pointer, the pointer is also selected; if it is less than, the value is selected, the pointer will be assigned to this value \(-1\)

E/H

With \ (lst_i \) represents the position of the first occurrence of a character; with \ (f_ {i, j} \) representing the forward \ (I \) characters in length \ (J \) is the number of mutually different

  • \ (lst_i = 0 \) , the first occurrence of the character described, \ (F_ {I, J}. 1-I = {F_, F_ {+} J-I. 1,. 1-J}, {I ++ F_ ,1}\)

  • \ (lst_i ≠ 1 \) , the foregoing description appeared in the character, we have to consider the inclusion-exclusion, apparently \ (lst_i \) in front of its prefix consisting of sequences can also be the \ (i \) the same sub-sequences, \ (f_ {i, j} = f_ {i-1, j} + f_ {i-1, j-1} -f_ {lst_i-1, j-1} \)

\ (F \) Number Composition exponentially, and \ (K \) is limited, so the limit \ (F \) does not exceed \ (K \)

Every prefers the longest sequence, like a direct answer statistics

F

G

Guess you like

Origin www.cnblogs.com/y2823774827y/p/11094831.html