Topic link Topic to the main effect
Given a forward graph, for the side I I have a limiting condition di d_i, which means that at the edge I I I must pass at least the other side of the Di d_i strip. At least a few sides are required to go from point 1 1 to n N. Solving
The more easily thought of violence is Fi,j f_{i, J} indicates that walking J-J Step can be exactly to I I point. Then Fi,j F_{i,j} can be transferred to Fk,j+1 F_{k, j+1}, K K is with I I have side e E and de≤j d_e \leq J.
This can only be done when di d_i is very small. So it doesn't seem to work.
Considering the previous idea of DNA sequence, the K-K-square of the adjacency matrix equals I I just walk K-K to J-J scheme number. Considering the constraints of the edges, if we have now passed the K-K step, then we can use only the edges of Di≤k d_i\le K. We can sort the edges in ascending order of Di d_i, add di d_i sequentially into the edge set, and segment the fast power transfer through the matrix. The arrival of the K-step between the maintenance point and the point goes. Note that we just need to know if we can get there and don't need to know the number of scenarios, then our matrix will always be 01 matrices. Using the naïve matrix multiplication in this problem will t drop, so with bitset acceleration. The accelerated matrix multiplication is as follows:
void Mul (bitset<n> *a, bitset<n> *b) {
bitset<n> ret[n];
Rep (i, 1, N) Rep (j, 1, N)
if (A[i][j]) ret[i] |= b[j];
Rep (i, 1, n) a[i] = Ret[i];
}
Bitset<n> A[n], b[n];
Mul (A, b);
The idea is that if