CF1943D2 Counting Is Fun (Hard Version)

Description

This is the hard version of the problem. The only difference between the two versions is the constraint on $ n $ . You can make hacks only if both versions of the problem are solved. An array $ b $ of $ m $ non-negative integers is said to be good if all the elements of $ b $ can be made equal to $ 0 $ using the following operation some (possibly, zero) times: - Select two distinct indices $ l $ and $ r $ ( $ 1 \leq l \color{red}{

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first test case, the $ 4 $ good arrays $ a $ are: - $ [0,0,0] $ ; - $ [0,1,1] $ ; - $ [1,1,0] $ ; - $ [1,1,1] $ .