How to solve problem ZERO from Dream Code 2.0?

Can anyone share their approach for solving [ZERO] from Dream Code 2.0 contest? (https://www.codechef.com/DRI22019/problems/ZMAGIC)

Its a direct application of meet in the middle.
You can learn it from -