After retiring to do title record

After retiring to do title record

I retired


AGC030E Less than 3

Immortal title Orz

First, if you modify a location \ (i \) , so \ (i-1 \) , \ (i + 1 \) must be different, otherwise it will appear the same three consecutive

A red line is inserted between the 0 and 1, a blue line is inserted between 1 and 0. Then the red and blue line must appear alternately

Moving a line equivalent modifications, equivalent to a move program matched (position 1 before, there can be seen a myriad of alternating red and blue line after the position n)

Best of all, "can not appear as three consecutive" no restrictions (because certainly be able to find solutions)

Matching program to enumerate

https://atcoder.jp/contests/agc030/submissions/6933519


AGC029B Garbage Collector

First, the cost of taking garbage fixed for \ (nX \) , can be ignored.

Set to take a \ (K \) times the garbage, put the cost of garbage would be \ (KX \) .

Consider first the process of taking the garbage, take a \ (\ ldots x_1 <x_2 < <x_s \) garbage at.

Obviously we will first go to \ (X_s \) , and then return to the way income spicy chicken.

Push, the cost would be \ (+ 5x_ 5x_s. 1} + {S-7x_} + {S-2 S-9x_. 3} + {\ ldots + (2S +. 1) x_1 \) .

Received \ (K \) times spicy chicken, there \ (2K \) coefficients \ (5 \) , \ (K \) coefficients \ (7,9,11, \ ldots \) , you can take to any \ (x \)

Obviously the biggest \ (2K \) a take \ (5 \) , and so on, prefixes and high on the list

https://atcoder.jp/contests/agc027/submissions/6921358


AGC018C Coins

First elimination \ (C \) . All \ (A, B \) becomes \ (AC, BC \) , plus the final answer \ (\ SUM C \) , you do not need to take \ (C \) , as long as take \ (x \) a \ ( A \) , \ (Y \) a \ (B \) .

Enumeration a boundary, the left and right are taken from small to large \ (A / B \) , with a stack maintenance

https://agc018.contest.atcoder.jp/submissions/6918307


LOJ6294 touch

I'm an idiot

Consider \ (\ sum_ {D | X} \ MU (D) = [X =. 1] \) , we ask \ (\ sum_ {path} \ sum_ {d | \ gcd \ {path \}} \ mu ( D) \) , i.e. for all \ (D \) how many paths are required \ (\ GCD \) is a multiple of

Seeking separate path across the edge and the remaining uncertainties, uncertainties side of the tree into two trees.

Uncertain path does not cross the edge of the direct request, enumeration \ (D \) , the weights are retained only the \ (D \) side multiples. Paths is \ (\ SUM \ Binom SIZ} 2 {\) , and to maintain the table

Uncertain path across the edge, \ (U, V \) separation of the two trees, the seizure of the two trees to all points \ (u / v \) a \ (\ GCD \) . Two trees \ (\ GCD \) referred to as the array \ (A, B \)

It is uncertain if the right side \ (W \) , which is part of the answer \ (\ sum_ {a \ in A, b \ in B, d | \ gcd (a, b, w)} \ mu (d) \)

Set \ (S_I = \ sum_ {A \ in A, B \ in B} [A | I] [B | I] \) (note that 0 to Japanese sentence) can be found in \ (a \ in A, b \ in B \) will \ (\ mathbb {lcm} ( a, B) \) is calculated once at multiples.

So if \ (i | w \) , the answer plus \ (S_I \ MU (i) \) , it will only count once the

https://loj.ac/submission/573269

Guess you like

Origin www.cnblogs.com/xzz_233/p/11366234.html
Recommended