Let \(\mathbb {N}\) be the set of all nonnegative integers. For \(S\subseteq \mathbb {N}\) and \(n\in \mathbb {N}\) , let the representation function \(R_{S}(n)\) denote the number of solutions of the equation \(n=s+s'\) with \(s, s'\in S\) and \(s<s'\) . In this paper, we determine the structure of \(C, D\subseteq \mathbb {N}\) with \(C\cup D=[0, m]\) , \(C\cap D=\{r_{1}, r_{2}\}\) , \(r_{1}<r_{2}\) and \(2\not \mid r_{1}\) such that \(R_{C}(n)=R_{D}(n)\) for any nonnegative integer n.