- A,B
Too easy to be necessary to say.
- C
Knapsack and suffix sum.
- D
Preprocess the occurrences of every number and use binary search for queries.
- E
If , obviously the answer is .
Otherwise, enumrate two points. Ensure these points are the first two points on the line. If there are at least points, add one to the answer.
Use integer to avoid precision error.
- F
Let the number of ways to fill the first columns and throw away edges and the two points in the last column are connected/unconnected.
Time complexity: .