diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README.md b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README.md
index 746d86d842f7c..5a5ed886954fc 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README.md	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README.md	
@@ -67,7 +67,18 @@ tags:
 
 <!-- solution:start -->
 
-### 方法一
+### 方法一:动态规划
+
+根据题目描述,我们可以得到以下结论:
+
+1. 从位置 $i$ 移动到位置 $j$ 时,如果 $nums[i]$ 和 $nums[j]$ 的奇偶性不同,那么会损失 $x$ 分;
+2. 从位置 $i$ 移动到位置 $j$ 时,如果 $nums[i]$ 和 $nums[j]$ 的奇偶性相同,那么不会损失分数。
+
+因此,我们可以用一个长度为 $2$ 的数组 $f$ 来表示当前位置的奇偶性为 $0$ 和 $1$ 时的最大得分。初始时 $f$ 的值为 $-\infty$,然后我们再初始化 $f[nums[0] \& 1] = nums[0]$,表示初始位置的得分。
+
+接下来,我们从位置 $1$ 开始遍历数组 $nums$,对于每个位置 $i$ 对应的值 $v$,我们更新 $f[v \& 1]$ 的值为 $f[v \& 1]$ 和 $f[v \& 1 \oplus 1] - x$ 的较大值再加上 $v$,即 $f[v \& 1] = \max(f[v \& 1], f[v \& 1 \oplus 1] - x) + v$。
+
+答案为 $f[0]$ 和 $f[1]$ 中的较大值。
 
 <!-- tabs:start -->
 
@@ -79,7 +90,7 @@ class Solution:
         f = [-inf] * 2
         f[nums[0] & 1] = nums[0]
         for v in nums[1:]:
-            f[v & 1] = max(f[v & 1] + v, f[v & 1 ^ 1] + v - x)
+            f[v & 1] = max(f[v & 1], f[v & 1 ^ 1] - x) + v
         return max(f)
 ```
 
@@ -92,7 +103,8 @@ class Solution {
         Arrays.fill(f, -(1L << 60));
         f[nums[0] & 1] = nums[0];
         for (int i = 1; i < nums.length; ++i) {
-            f[nums[i] & 1] = Math.max(f[nums[i] & 1] + nums[i], f[nums[i] & 1 ^ 1] + nums[i] - x);
+            int v = nums[i];
+            f[v & 1] = Math.max(f[v & 1], f[v & 1 ^ 1] - x) + v;
         }
         return Math.max(f[0], f[1]);
     }
@@ -110,7 +122,8 @@ public:
         f[nums[0] & 1] = nums[0];
         int n = nums.size();
         for (int i = 1; i < n; ++i) {
-            f[nums[i] & 1] = max(f[nums[i] & 1] + nums[i], f[nums[i] & 1 ^ 1] + nums[i] - x);
+            int v = nums[i];
+            f[v & 1] = max(f[v & 1], f[v & 1 ^ 1] - x) + v;
         }
         return max(f[0], f[1]);
     }
@@ -125,7 +138,7 @@ func maxScore(nums []int, x int) int64 {
 	f := [2]int{-inf, -inf}
 	f[nums[0]&1] = nums[0]
 	for _, v := range nums[1:] {
-		f[v&1] = max(f[v&1]+v, f[v&1^1]+v-x)
+		f[v&1] = max(f[v&1], f[v&1^1]-x) + v
 	}
 	return int64(max(f[0], f[1]))
 }
@@ -135,13 +148,13 @@ func maxScore(nums []int, x int) int64 {
 
 ```ts
 function maxScore(nums: number[], x: number): number {
-    const inf = 1 << 30;
-    const f: number[] = Array(2).fill(-inf);
+    const f: number[] = Array(2).fill(-Infinity);
     f[nums[0] & 1] = nums[0];
     for (let i = 1; i < nums.length; ++i) {
-        f[nums[i] & 1] = Math.max(f[nums[i] & 1] + nums[i], f[(nums[i] & 1) ^ 1] + nums[i] - x);
+        const v = nums[i];
+        f[v & 1] = Math.max(f[v & 1], f[(v & 1) ^ 1] - x) + v;
     }
-    return Math.max(f[0], f[1]);
+    return Math.max(...f);
 }
 ```
 
diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README_EN.md b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README_EN.md
index b38632b020df1..c5ea471975abf 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README_EN.md	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/README_EN.md	
@@ -67,7 +67,18 @@ The total score is: 2 + 4 + 6 + 8 = 20.
 
 <!-- solution:start -->
 
-### Solution 1
+### Solution 1: Dynamic Programming
+
+Based on the problem description, we can draw the following conclusions:
+
+1. Moving from position $i$ to position $j$, if $nums[i]$ and $nums[j]$ have different parities, then $x$ points will be lost;
+2. Moving from position $i$ to position $j$, if $nums[i]$ and $nums[j]$ have the same parity, then no points will be lost.
+
+Therefore, we can use an array $f$ of length $2$ to represent the maximum score when the current position's parity is $0$ and $1$. Initially, the values of $f$ are $-\infty$, and then we initialize $f[nums[0] \& 1] = nums[0]$, indicating the score at the initial position.
+
+Next, we start traversing the array $nums$ from position $1$. For each position $i$ corresponding to the value $v$, we update the value of $f[v \& 1]$ to be the larger value between $f[v \& 1]$ and $f[v \& 1 \oplus 1] - x$ plus $v$, i.e., $f[v \& 1] = \max(f[v \& 1], f[v \& 1 \oplus 1] - x) + v$.
+
+The answer is the larger value between $f[0]$ and $f[1]$.
 
 <!-- tabs:start -->
 
@@ -79,7 +90,7 @@ class Solution:
         f = [-inf] * 2
         f[nums[0] & 1] = nums[0]
         for v in nums[1:]:
-            f[v & 1] = max(f[v & 1] + v, f[v & 1 ^ 1] + v - x)
+            f[v & 1] = max(f[v & 1], f[v & 1 ^ 1] - x) + v
         return max(f)
 ```
 
@@ -92,7 +103,8 @@ class Solution {
         Arrays.fill(f, -(1L << 60));
         f[nums[0] & 1] = nums[0];
         for (int i = 1; i < nums.length; ++i) {
-            f[nums[i] & 1] = Math.max(f[nums[i] & 1] + nums[i], f[nums[i] & 1 ^ 1] + nums[i] - x);
+            int v = nums[i];
+            f[v & 1] = Math.max(f[v & 1], f[v & 1 ^ 1] - x) + v;
         }
         return Math.max(f[0], f[1]);
     }
@@ -110,7 +122,8 @@ public:
         f[nums[0] & 1] = nums[0];
         int n = nums.size();
         for (int i = 1; i < n; ++i) {
-            f[nums[i] & 1] = max(f[nums[i] & 1] + nums[i], f[nums[i] & 1 ^ 1] + nums[i] - x);
+            int v = nums[i];
+            f[v & 1] = max(f[v & 1], f[v & 1 ^ 1] - x) + v;
         }
         return max(f[0], f[1]);
     }
@@ -125,7 +138,7 @@ func maxScore(nums []int, x int) int64 {
 	f := [2]int{-inf, -inf}
 	f[nums[0]&1] = nums[0]
 	for _, v := range nums[1:] {
-		f[v&1] = max(f[v&1]+v, f[v&1^1]+v-x)
+		f[v&1] = max(f[v&1], f[v&1^1]-x) + v
 	}
 	return int64(max(f[0], f[1]))
 }
@@ -135,13 +148,13 @@ func maxScore(nums []int, x int) int64 {
 
 ```ts
 function maxScore(nums: number[], x: number): number {
-    const inf = 1 << 30;
-    const f: number[] = Array(2).fill(-inf);
+    const f: number[] = Array(2).fill(-Infinity);
     f[nums[0] & 1] = nums[0];
     for (let i = 1; i < nums.length; ++i) {
-        f[nums[i] & 1] = Math.max(f[nums[i] & 1] + nums[i], f[(nums[i] & 1) ^ 1] + nums[i] - x);
+        const v = nums[i];
+        f[v & 1] = Math.max(f[v & 1], f[(v & 1) ^ 1] - x) + v;
     }
-    return Math.max(f[0], f[1]);
+    return Math.max(...f);
 }
 ```
 
diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.cpp b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.cpp
index f46acc1a46c0e..a6c83e43b8c28 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.cpp	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.cpp	
@@ -6,7 +6,8 @@ class Solution {
         f[nums[0] & 1] = nums[0];
         int n = nums.size();
         for (int i = 1; i < n; ++i) {
-            f[nums[i] & 1] = max(f[nums[i] & 1] + nums[i], f[nums[i] & 1 ^ 1] + nums[i] - x);
+            int v = nums[i];
+            f[v & 1] = max(f[v & 1], f[v & 1 ^ 1] - x) + v;
         }
         return max(f[0], f[1]);
     }
diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.go b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.go
index 3e0f6b6af1a58..9a0ed8ee66ce1 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.go	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.go	
@@ -3,7 +3,7 @@ func maxScore(nums []int, x int) int64 {
 	f := [2]int{-inf, -inf}
 	f[nums[0]&1] = nums[0]
 	for _, v := range nums[1:] {
-		f[v&1] = max(f[v&1]+v, f[v&1^1]+v-x)
+		f[v&1] = max(f[v&1], f[v&1^1]-x) + v
 	}
 	return int64(max(f[0], f[1]))
 }
\ No newline at end of file
diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.java b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.java
index 8cc079c29be30..95523eb596781 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.java	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.java	
@@ -4,7 +4,8 @@ public long maxScore(int[] nums, int x) {
         Arrays.fill(f, -(1L << 60));
         f[nums[0] & 1] = nums[0];
         for (int i = 1; i < nums.length; ++i) {
-            f[nums[i] & 1] = Math.max(f[nums[i] & 1] + nums[i], f[nums[i] & 1 ^ 1] + nums[i] - x);
+            int v = nums[i];
+            f[v & 1] = Math.max(f[v & 1], f[v & 1 ^ 1] - x) + v;
         }
         return Math.max(f[0], f[1]);
     }
diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.py b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.py
index 71aff1444cc22..f6aed0dcbcc31 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.py	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.py	
@@ -3,5 +3,5 @@ def maxScore(self, nums: List[int], x: int) -> int:
         f = [-inf] * 2
         f[nums[0] & 1] = nums[0]
         for v in nums[1:]:
-            f[v & 1] = max(f[v & 1] + v, f[v & 1 ^ 1] + v - x)
+            f[v & 1] = max(f[v & 1], f[v & 1 ^ 1] - x) + v
         return max(f)
diff --git a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.ts b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.ts
index 45434278455c0..ed8f80850f858 100644
--- a/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.ts	
+++ b/solution/2700-2799/2786.Visit Array Positions to Maximize Score/Solution.ts	
@@ -1,9 +1,9 @@
 function maxScore(nums: number[], x: number): number {
-    const inf = 1 << 30;
-    const f: number[] = Array(2).fill(-inf);
+    const f: number[] = Array(2).fill(-Infinity);
     f[nums[0] & 1] = nums[0];
     for (let i = 1; i < nums.length; ++i) {
-        f[nums[i] & 1] = Math.max(f[nums[i] & 1] + nums[i], f[(nums[i] & 1) ^ 1] + nums[i] - x);
+        const v = nums[i];
+        f[v & 1] = Math.max(f[v & 1], f[(v & 1) ^ 1] - x) + v;
     }
-    return Math.max(f[0], f[1]);
+    return Math.max(...f);
 }