Garden Click Coefficient¶
Reference time limit: 0.5 s; memory limit: 128 MiB. Use twice the slowest formal-file median on the target platform, rounded up to 0.5 seconds. See the benchmark environment.
Story¶
A cookie factory has unlocked a small garden. Its gardener may change the plants and soil to maximize the cookie coefficient obtained from each click when the garden is unfrozen.
(This story was rewritten by GPT-6.)
Formal Problem Statement¶
Each cell of an \(n\times m\) rectangle has exactly one type from the table. All cells use the same soil coefficient \(S\in\{1,1.25\}\) . The achievement count is \(A\) .
| Type | Meaning | Effect |
|---|---|---|
| E | Empty | None |
| B | Wheat | Production bonus |
| T | Corn | Click bonus |
| W | Bloom | Milk bonus |
| N | Nurse tulip | Amplifies neighboring plants |
| D | Fern | Production bonus and click penalty |
| G | Glove mushroom | Click and cursor bonuses, production penalty |
Two distinct cells are neighbors when both coordinate differences are at most one. If cell \(i\) has \(a_i\) neighboring N cells, its effect coefficient, when it is not N, is
N cells do not amplify other N cells and have no direct production effect. A type letter below denotes the set of cells of that type. Empty sums are zero and empty products are one.
Maximize
These formulas fully define the problem. Neither \(C_{\rm click}\) nor \(f_W\) has an additional constant one. Ignore golden-cookie effects.
The N cell affects every neighboring non-N cell, including diagonal neighbors.
Input Format¶
One line contains n m A .
Output Format¶
Print the maximum coefficient. The absolute or relative error may be at most \(10^{-9}\) : an output \(x\) and optimum \(y\) must satisfy \(|x-y|\le10^{-9}\max(1,|y|)\) .
Example 1¶
Input¶
1 1 0
Output¶
4.940215625000000000e-02
Example 2¶
Input¶
2 2 1000
Output¶
1.906043514560546875e-01
Example 3¶
Input¶
2 4 1000
Output¶
5.854567874453084032e-01
Constraints and Guarantees¶
\(n,m\ge1\) , \(nm\le8\) , and \(0\le A\le1000\) .
Redesign by Codex (GPT-6): the source omitted bounds, output rules, and examples. This edition supplies them and resolves the conflicting neighbor formula in favor of the stated 20% amplification, using \(0.2a_iS\) . All other factors and exponents are retained.
| Score | Additional conditions |
|---|---|
| 100% | None |
Ten formal files, worth 10% each. Generation guide.