We have constructed a rhombus by attaching two equal equilateral triangles. By putting $n-1$ points on all 3 sides of each triangle we have divided the sides to $n$ equal segments. By drawing line segements between correspounding points on each side of the triangles we have divided the rhombus into $2n^2$ equal triangles.
We write the numbers $1,2,\dots,2n^2$ on these triangles in a way no number appears twice. On the common segment of each two triangles we write the positive difference of the numbers written on those triangles. Find the maximum sum of all numbers written on the segments.

(25 points)
[i]Proposed by Amirali Moinfar[/i]
1. **Understanding the Problem:**
   We have a rhombus constructed by attaching two equal equilateral triangles. Each side of the triangles is divided into \( n \) equal segments by placing \( n-1 \) points on each side. By drawing line segments between corresponding points on each side of the triangles, the rhombus is divided into \( 2n^2 \) equal triangles. We need to find the maximum sum of the positive differences written on the common segments of these triangles when the numbers \( 1, 2, \ldots, 2n^2 \) are written on the triangles such that no number appears twice.

2. **Classification of Triangles:**
   - **Vertex Triangles:** These are the two triangles that share only one side with other triangles.
   - **Edge Triangles:** These are the \( 4(n-1) \) triangles that share two sides with other triangles.
   - **Interior Triangles:** These are the remaining \( 2(n-1)^2 \) triangles that share three sides with other triangles.

3. **Sum on Edges:**
   The sum on the edges can be expressed in terms of the differences between the numbers on adjacent triangles. For each type of triangle, the contribution to the sum can be written as:
   - Vertex triangles contribute \( \pm 1 \).
   - Edge triangles contribute \( \pm 2 \) or \( 0 \).
   - Interior triangles contribute \( \pm 3 \), \( \pm 1 \), or \( 0 \).

4. **Maximizing the Sum:**
   To maximize the sum, we need to consider the maximum possible differences. The sum of the differences can be written as:
   \[
   \sum a_i \times i
   \]
   where \( a_i \) is the coefficient corresponding to the type of triangle and \( i \) is the difference.

5. **Calculating the Maximum Sum:**
   The maximum sum can be calculated by considering the maximum possible differences for each type of triangle:
   \[
   3 \times (2n^2 + \ldots + n^2 + 2n) + 2 \times (n^2 + 2n - 1 + \ldots + n^2 + 2) + 1 \times (n^2 + 1) - 1 \times (n^2) - 2 \times (n^2 - 1 + \ldots + n^2 - 2n + 2) - 3 \times (n^2 - 2n + 1 + \ldots + 1)
   \]

6. **Simplifying the Expression:**
   Simplifying the above expression, we get:
   \[
   3n^4 - 4n^2 + 4n - 2
   \]

7. **Constructing the Example:**
   To construct an example that achieves this maximum sum, we can use a chessboard coloring of the rhombus. Place numbers greater than \( n^2 \) on black triangles and the others on white triangles. Specifically:
   - Place \( n^2 + 1, n^2 \) on vertex triangles.
   - Place \( n^2 + 2, \ldots, n^2 + 2n - 1 \) and \( n^2 - 1, \ldots, n^2 - 2n + 2 \) on edge triangles.
   - Place the remaining numbers on interior triangles.

Therefore, the maximum sum of all numbers written on the segments is \( 3n^4 - 4n^2 + 4n - 2 \).

The final answer is \( \boxed{ 3n^4 - 4n^2 + 4n - 2 } \).