cswork / OA打开练习工作台

MillenniumOA #1

Dual-Core Processor with Latch (Game DP)

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)树形博弈

A dual-core processor has one process queue per core. There are n processes; time[i] is the processing time of the i-th. There is a latch that decides which core picks. Initially the latch is with core 1. When the latch is held by core c and process i needs to be assigned, one of the two operations must be performed:

  • Assign process i to core c; pass the latch to the other core.
  • Assign process i to the other core; the latch stays with core c.

Each core, when it holds the latch, picks the operation that maximizes its own total accumulated time. Return [total_core1, total_core2] under optimal play.

Example

n = 5
time = [10, 21, 10, 21, 10]
Output: [41, 31]

Constraints

  • 1 ≤ n ≤ 10⁵
  • 1 ≤ time[i] ≤ 10⁹