It took me nearly seven hours to solve the 6/7 problems. Some useful ideas can be found among them.

An easy problem.

#### Zigzag Array

An east problem. I accepted it by a method similar with two pointer.

#### Maximal AND Subsequences

Given an arry with $n\leq 10^5$ long integers $A_{i}\leq 10^{18}$, try to find all the $k$-element subsequences of $A$ where the bitwise AND of the subsequence’s elements is maximal.

This problem is very common actually, and I lost my mind during that time.

We can use a greedy strategy, due to the truth that:
$$2^{i} > 2^{i-1}+2^{i-2}+\cdots + 2^{0}$$

We consider the bits in number two system from high to low. For each bit, we calculate the number of elements whose expression at the bit is 1. If the number is larger than or equal to $k$, then we need to delete all other elements whose expression at the bit is 0. That means the maximal AND value must result from those bit-1 elements. The elements left last make up a set from which we can choose $k$ elements.

I choose the data structure multiset to support the delete operation. But vector, list and so on are optional.

The time complexity is $O(n\log^2 n)$.

#### Permutation Happiness

Try to think in dynamic programming, and thx to erikwei.

#### Maximum Disjoint Subtree Product

This is a tree-dp problem with two times dfs. Be in a clear mind while coding this problem. I spent nearly two hours finishing it, and got accepted at the second sumbit (the first submit failed because I forgot to add one line code for dfs2() function).

#### Node-Point Mappings

To be honest this is a old problem as it is the same meaning with CF196 C. I have seen it about one month before. So copy and paste may be a good choice. 23333.