
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
In recent years, the emergence of "shared bicycles" has greatly facilitated the "green travel" for citizens. A shared bicycle company "Mobie" plans to invest a total of 1.2 million yuan in two cities, A and B. According to industry regulations, each city must receive an investment of at least 400,000 yuan. Preliminary market research shows that the profit $P$ in city A and the investment $a$ (in units of 10,000 yuan) satisfy $P=3 \sqrt{2a}-6$, and the profit $Q$ in city B and the investment $a$ (in units of 10,000 yuan) satisfy $Q= \frac{1}{4}a+2$. Let the investment in city A be $x$ (in units of 10,000 yuan), and the total profit of the two cities be $f(x)$ (in units of 10,000 yuan).

$(1)$ When the investment in city A is 500,000 yuan, calculate the total profit of the company at this time;

$(2)$ How should the investments in cities A and B be arranged to maximize the total profit?

Present the answer in LaTex format: \boxed{Your answer}
user