Div2 done after the discovery of open questions QwQ
A Fox And Names
B Fox And Jumping
Title Description
You want to traverse a length of the endless loop
There \ (n \) kinds of cards, you can spend \ (c_i \) the cost of purchase of \ (i \) kinds of cards and unlimited use, every time you can make cis / counterclockwise jump \ (a_i \) Step and asked whether there is a program that you can traverse all the points, and if so, the minimum cost output
\ (1 \ leq n \ leq 300,1 \ leq a_i \ leq 10 ^ 9,1 \ leq c_i \ leq 10 ^ 5 \)
analysis
Yeah I'm young
First, the problem may be simplified if there is a solution, such that \ (\ a_i * SUM. 1 x_i = \) , wherein, \ (a_i \) is selected from the group of those cards, \ (x_i \) is an arbitrary integer
Because if you can go one step toward a certain direction, then you can traverse the entire ring, and if you want to traverse the entire ring, they are bound to have a scheme can go one step further in a certain direction
Well, then according to Shu Pei extension theorem, all \ (a_i \) is \ (gcd \) To \ (1 \) , then direct \ (dp \) on it
Found that the number of gcd's not too much, you can use a map
C Fox And Dinner
Title Description
Given \ (n-\) a \ ([2,100] \) number, asked whether them into several rings greater than or equal to 3, such that any adjacent two numbers and a prime number
\ (1 \ leq n \ leq 100 \)
analysis
Since the value is greater than 2, the number of two prime numbers and a is necessarily an odd-even. All the odd number into two, left and right each have two number of different parity and their numbers, so the \ (S \) to each of the odd-even point \ (2 \) sides, from each even point to the \ (T \) connected \ (2 \) edge, running the network flow to OK