This recent problem Bank Cooperation, from Heist is solved using bit manipulation in editorial but i think it is solvable by my approach too.

I thought of all 8 items as nodes in graph, where the paired up elements will form one component, now in components we cannot take neighbouring nodes, as they cant be put together. I found the maximum value that we can take from a component by doing modified dfs, and then added the maximum values of all the components.

I have thought of many cases but cant figure out why its wrong, please help…