cswork / OA打开练习工作台

IBMOA #52

Maximum Efficiency

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

考点(AI 标注)原地数组贪心调度

When evaluating a machine learning model, n test cases are provided. Each is associated with an arrivalTime[i] indicating the times each test case was given. The testing environment is activated once for some time, then enters an inactive state. If activated at time t1 and deactivated at time t2, tests with arrival times between t1 and t2 (inclusive) are executed. The total time the system was active is t2 - t1. Efficiency of testing system = number of test cases tested / total time the system was active Determine the maximum efficiency when the testing environment selects optimum activation and deactivation times. The active environment must execute at least two test cases during its active period. Return the maximum possible efficiency. Notes:

  • Execution time for test cases is practically instantaneous; that is, it takes almost no time.
  • If two test cases share the same arrival time, they are evaluated simultaneously.
  • Efficiency may take negative values.

Constraints

  • 2 ≤ n ≤ 2 × 10⁵
  • 1 ≤ arrivalTime[i] ≤ 10⁹