Let's suppose we have $N$ molecules of a diatomic ideal gas at temperature $T_1$ and pressure $P_1$ inside a constant volume $V$. The system is isolated from the surroundings so that the internal energy remains constant. The diatomic gas reacts decomposing into a monoatomic one, according to this reaction: $A_2\rightarrow2A+Q$, where $Q$ is the heat released in the reaction (which is exothermic). I need to find out the expression of the final temperature of the system, $T_2$, once all the molecules of the diatomic gas have reacted.
I know that for ideal gases $U=nc_VT$, with $U$ the internal energy of the gas and $c_V$ its molar heat capacity, and that $c_V$ is different for diatomic and monoatomic gases. However, by combining these formulas I don't get the right solution.
How could this be solved?