Company: Growth jockey_10oct
Difficulty: medium
GrowthJockey Task Workflow Problem Description GrowthJockey's engineering platform manages a massive workflow of 10 9 task nodes, numbered from 1 to 10 9 . Each task node is either complete (black) or pending (white). Initially, there are m distinct completed tasks: a_1, a_2, ..., a_m . All other tasks are still pending. You are given a sequence of commands that GrowthJockey's automation engine will execute. Each command can be of two types: A -- Move to the next task ( x + 1 ) B -- Skip to the nearest pending (white) task to the right For each command prefix i (from 1 to n ), a new worker starts at task 1. The worker executes the first i commands from the string. The worker marks the last visited task as complete (black). Your job is to find out which task nodes are black after all workers finish their execution. Input The first line contains an integer t — the number of test cases. Each test case consists of: Two integers n and m — the number of commands and initially completed tasks