Array and Operations "CodeForces-498C"
given n points m and a set of edges, each operation can be connected to two sides of the same time point value divided by a divisor, ask the maximum number of operations
The meaning of problems
Given an array of length $ n-$ and $ m $ of the labeled $ (a, b) $ of points, and satisfies the subscripts a + b is an odd number (i.e., the odd dot matched only with even numbers), each operation can be two numbers divided by the same group at the same time a number of conventions, the most asked how many operations can be performed.
solution
Apparently the subject is given a bipartite graph.
For each prime factor considered separately. For odd dot, a source connected to the capacity factor for the number of sides; for even point is established with a capacity factor of the number of sides of the sink; edged connected to a point of establishing a capacity of $ $ INF side.
For topic and array $ a [i] $, the obtained solution is calculated for each prime factor, by way of built FIG decomposition of the quality factor of maximum flow, is the summation.
Code
1 |
|
Original: Big Box "CodeForces-498C" Array and Operations (number theory + network streams)