We need to find the ratio of the total electrostatic energy stored in two capacitors before and after introducing a dielectric.
Step 1: Initial energy (switch closed).
Capacitors \( A \) and \( B \) are in parallel, each with capacitance \( C \), connected to a battery of voltage \( V \). Total capacitance:
\[
C_{\text{total, initial}} = C + C = 2C
\]
Initial energy:
\[
U_{\text{initial}} = \frac{1}{2} (2C) V^2 = C V^2
\]
Step 2: After opening the switch.
The switch is opened, so the total charge is conserved:
\[
Q_{\text{total}} = 2C V
\]
Step 3: After introducing the dielectric.
Dielectric constant \( \kappa = 3 \). New capacitance of each capacitor:
\[
C_{\text{new}} = 3C
\]
Total capacitance:
\[
C_{\text{total, final}} = 3C + 3C = 6C
\]
New voltage:
\[
V_{\text{new}} = \frac{2C V}{6C} = \frac{V}{3}
\]
Final energy:
\[
U_{\text{final}} = \frac{1}{2} (6C) \left( \frac{V}{3} \right)^2 = \frac{1}{2} (6C) \cdot \frac{V^2}{9} = \frac{C V^2}{3}
\]
Step 4: Compute the ratio.
\[
\frac{U_{\text{initial}}}{U_{\text{final}}} = \frac{C V^2}{\frac{C V^2}{3}} = 3 \implies U_{\text{initial}} : U_{\text{final}} = 3 : 1
\]
Final Answer:
\[
\boxed{3 : 1}
\]