2019 Summer Hang two day2 test summary

T1

Subject to the effect

Given a string \ (S \) , to obtain a sequence, so that the original sequence of each character appears and only once, and the minimum lexicographic sequence.

sol

T1 I had 90 points, bizarre \ (WA \) the first point, positive solution to easily than I algorithm maintains a stack for each character, if you have to skip directly within the stack; otherwise, if character than its big stack, and then appeared before, then pop stack, in the future add to the mix (greedy), will not play when the current character added to the stack. Finally, the output can stack up from the bottom.

T2

Subject to the effect

There is a text box and a clipboard, start a text box contents, the clipboard is empty. Every three operations can be performed:

  1. Copy all the contents of the text box to the clipboard;
  2. The contents of the clipboard into the text box;
  3. Finally, delete the contents of a text box.

Set \ (f (x) \) is ground to \ (X \) a content, the number of operations requires a minimum of seeking
\ [\ sum_ {i = 1 } ^ nf (x) * 1920817 ^ {ni} (mod \ space998244353) \]
\ (n-<#### = 2,000,000 Sol difficulty is seeking \) F (X) \ (, I found that this is a shortest path, and then to the text box of the clipboard coordinates, building a \) 2 ^ n- \ (points, the edge weights are 1, a corresponding one of the operation, only 40 minutes. In fact, this problem may utilize the right side, the building \) n-50 + \ (points, each point \) X \ (to \) X-. 1 \ (even edge weight as a side to \) I X (I X = n-+ 50 <) \ (even edge weight as \) I \ (edge, in order to optimize, can only in \) I \ (prime number not more than 11 even when the side, when \) I \ time (is a composite number, can be copied and pasted scrape out several times, and more preferably the answer. when \) n- \ (greater than 11 ~ ~ ~ ~ can be demonstrated when a certain metaphysical not preferable. FIG built after run \) SPFA \ (to find the single source shortest line actually slower Dijkstra ~~ ~~. ### T3 #### subject to the effect a given \) n-m *\ (Matrix, the matrix there are some positions are obstacles (given coordinates), we can not pass. Now from the \) (0,0) \ (go \) (the n-, m) \ (, and can only go up right away, go find how many hair. two moves are not the same if and only if one moves a disorder of the path on the left, in another take the right path method \) (. 1 <= n-, m <= 10 ^. 9) \ (. Sol #### I began to write accessible only 5 minutes, positive solution is the discretization \) DP \ (, provided \) F [I] [J] \ (as points to the first \) i \ (line \) J $ program number columns, no obstacles can only go to the right, obstacles can only go up, the number of programs superimposed on the line, you can add a segment tree scanning line optimization. More details of the code, I do not realize.

Guess you like

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