Here is a rough sketch of my idea:
Prime numbers are distributed as follows x / ln (x) .
Also use the borders on this page to find where the closest downtime is relative to the amount of wine in this glass.
Once you find these numbers, you can reduce the problem to a graph with edges that have costs, which represent values ββfor moving from one glass to another (your type 1). And the nodes will be the glasses themselves.
Here you are left with a graph problem, and you need to think about the minimum cost paths on this graph. Your goal is to find the path to the minimum cost, which will lead to a state where all points are prime numbers.
If there are glasses that prevent you from doing this, drink them (moving type 2), the wine is right for you :)
UPDATE
I will write here some of the real thoughts that we discussed in the chat:
- bilateral compliance has been mentioned and it is likely that the problem can be reduced to
- you can first get the main sections between every 2 points (the main sections of the sum of every 2 points), and these sections are edges in the graph. you also add edges for type 2 moves. You can tie the costs one way or another and then run the minimum flow algorithm to solve the problem.
- The problem may also be that you need all of the facets mentioned above, since the optimal solution may not imply the adoption of an optimal simple parity for each of the points
source share