QOJ

Time Limit:5 s Memory Limit:512 MB

#3079. Joining The Bricks Together

Attention: The time limit was revised to 5.0 seconds.

The size of the input file does not exceed 50.0 MiB.

It is guaranteed that $\sum n \leq 1.2 \times 10^7$