Company: Growth jockey_9oct
Difficulty: medium
Task Completion Simulation Problem Description GrowthJockey's engineering platform tracks a workflow of 10^9 task nodes, numbered from 1 to 10^9 . Every task node is either completed (black) or pending (white) . Initially exactly m distinct tasks a[1], a[2], ..., a[m] are completed, and every other task is pending. The automation engine runs a command string s of length n . Each character is one of two commands, applied to a worker standing on task x : A - move to the next task, x + 1 (whatever its colour). B - jump to the nearest pending task strictly to the right, that is, the smallest y > x whose task is white. The workers are processed one after another, for i = 1, 2, ..., n : 1. A new worker starts on task 1 . 2. The worker executes the first i commands of s , in order: s[1], s[2], ..., s[i] . 3. The worker marks the task it finishes on as completed (black). If that task is already black, nothing changes. Marks are permanent, so every worker sees the tasks completed by all earl