USACO 4.3 analysis

 Topic 1: Buy low, buy lower

** Description: How many different sequences are in the longest descending subsequence?
** Algorithm: DP + BIGN
** Analysis: BASIC b[i] = b[j]+1 | a[j]> a[i] and b[j]+1> b[i], 1 <= j <i
    If the calculation is repeated, then
       cnt[i] += cnt[j] | a[j]> a[i] and b[j]+1 = b[i]. 1 <= j <i;
       cnt[i ] = MAX(1);
** Special Test: 9 7 5 8 5 1 Dp 1 2 3 2 3 4 Num 1 1 1 1 2 2
 For the first 5 and the second 5, their dp is the same. But num is different.
 Here we can take the last 5 for the following reasons: For a sequence that is not the last 5, the last 5 must be available.
 For example, for the second 5, the 9 75 sequence of the first 5, the second 5 can also be obtained. And the following 5 may have more options,
 such as the second 5 in the above example, you can also get the 9 8 5 sequence. So here, the num corresponding to the last 1 should be 2.

 

Topic 2: The Primes

A very troublesome topic, it took a long time to stop TLE, and I don’t want to write it a second time!

 

Topic 3: Street Race

** Description: The first question is to find the cut of a directed graph, and the second is to find the cut of an undirected graph.
** Algorithm: DFS
** Analysis: 3 properties of a complete graph:
    1. Any point can be reached from the starting point ;
    2. can reach any point end;
    3. end a is 0;
    first question guarantees that no answer from the division of the 1 to 2 divided side;
    the second question answer 2 while ensuring not to split the split 1 Side;
   so the second question can be developed on the basis of the first question. At the same time, it can be guaranteed that the two parts of the split are complete graphs!
    However, it seems that there is no judgment in the data that the segmentation point of the second question has no self-loop edges.

I found this kind of data when I handed it in, but it is calculated according to what is possible

Topic 4: Letter Game

** Description: The key to this question is to understand the meaning of the question:
** The correct understanding should be to find a combination of one or two words in the given DICT, so
      that the number of occurrences of each letter is not more than the given input The number of each letter in the string
** Analysis: At first, I might be afraid of enumeration. It should feel that the data range is large, but after preliminary selection, only a small part of the
    two cases can be enumerated. Just one click
** NOTE: Since it needs to be in lexicographical order, the last one can be set as an empty string

 

 

Guess you like

Origin blog.csdn.net/zjsxzjb/article/details/6370521