Inversions Optimization in XOR-Majority Graphs with an Application to QCA