2019 Summer Hang two day7 test summary

T1

Subject to the effect

\(\sum_{i=1}^n\sum_{j=1}^n\mu(gcd(i,j))\%998244253,n\le 10^{10}\)

sol

\ [\ Sum_ {i = 1 } ^ n \ sum_ {j = 1} ^ n \ mu (gcd (i, j)) \\ = \ sum_ {k = 1} ^ n \ sum_ {i = 1} ^ n \ sum_ {j = 1} ^ n \ mu (k) [gcd (i, j) = k] \\ = \ sum_ {k = 1} ^ n \ mu (k) \ sum_ {i = 1} ^ {\ lfloor \ frac {n} {k} \ rfloor} \ sum_ {j = 1} ^ {\ lfloor \ frac {n} {k} \ rfloor} [gcd (i, j) = 1] \\ = \ sum_ {k = 1} ^ n \ mu (k) \ sum_ {i = 1} ^ {\ lfloor \ frac {n} {k} \ rfloor} \ sum_ {j = 1} ^ {\ lfloor \ frac {n } {k} \ rfloor} \ sum_ {d | i \ & d | j} \ mu (d) \\ = \ sum_ {k = 1} ^ n \ mu (k) \ sum_ {d = 1} ^ {\ lfloor \ frac {n} {k } \ rfloor} \ mu (d) \ sum_ {i = 1} ^ {\ lfloor \ frac {n} {kd} \ rfloor} \ sum_ {j = 1} ^ {\ lfloor \ frac {n} {kd} \ rfloor} \\ order sum (x) = \ sum_ { i = 1} ^ n1 \\ the original formula = \ sum_ {k = 1} ^ n \ mu (k) \ sum_ {d = 1} ^ {\ lfloor \ frac {n} {k} \ rfloor} \ mu (d) sum ({\ lfloor \ frac {n} {kd} \ rfloor}) ^ 2 \\ k considered enumeration \ times d \\ original formula = \ sum_ {T = 1} ^ n \ sum_ {d | T} \ mu (d) \ mu (\ frac {T} {d}) sum ({\ lfloor \ frac {n } {kd} \ rfloor}) ^ 2 \\ order f (x) = \ sum_ { i | x} \ mu (i) \ mu (\ frac {x} {i}) = (\ mu * \ mu) original formula \\ = \ sum_ {T = 1}
^ nf (T) sum (\ lfloor \ frac {n} {T} \ rfloor) ^ 2 \] behind significantly block is divisible, the problem becomes how to quickly find\ (f (x) \) prefix and, can explain the problem to teach Du screen, but I just do not screen \ ((\ MU * \ MU) \) , just write a line screen points.

T2

Subject to the effect

Given a string of only lowercase letters, find the number of their different nature of the sequences, \ (len \ Le ^ 10. 6, ANS \) of \ (998,244,353 \) modulo.

sol

I was like a tree with a tire to maintain the number of sub-sequence, it is clear that the number of programs explosion.

In fact, positive solution does not require any data structure is very simple.

Consider the number of recursion set f [i] inherently different for the first sub-i-letter sequence. \ (F [I] =. 2F [-I. 1] \) . But there will be a lot of duplicate, let \ (s_i \) is the i-th letter, we need to subtract before \ (s_i \) number at the end of the sequence, these calculations are repeated once. In \ (S_I \) at the end of the sequence number can also be recursive, + = f [i] -f [i-1] on the line, because the multi produces so much contribution.

T3

Subject to the effect

Please maintain a collection initially empty point, supports the following operations:

  • A xy addition point (x, y)
  • Q lrxy maximum matching degree interrogation point (x, y) and the l-th points r

The point (x, y) and the matching degree (a, b) is ax + by

sol

I just wrote the violence.

Positive solution of this problem into the geometric problems, provided ax + by = k, then \ (- \ FRAC {X} {Y} A + \ FRAC {K} {Y} = B \) , the problem becomes to a fixed slope linear, at some point over the range that the intercept minimized. Then becameI will notConvex Hull segment tree maintenance.

Guess you like

Origin www.cnblogs.com/hht2005/p/11402646.html