Comments

Headquarters

All numbers from $$$1$$$ to $$$m$$$ must be divisors of at least one number in your choice of the team

If you arbitrarily pick $$$3$$$ or $$$7$$$, it will be divisible by $$$1$$$, yes. But neither of them is divisible by $$$2$$$ or $$$4$$$. You need to find a multiple of each of the numbers $$$m = 1,2,3,4$$$, not just one of them.

On Nanako → Good Bye 2022: 2023 is NEAR, 4 years ago
0

In the $$$j$$$-th operation, we are changing a number on the whiteboard to $$$b_j$$$. This implies that the ordering of the array $$$b$$$ is significant and plays a role in the problem. Hence, you cannot change the order.

On Nanako → Good Bye 2022: 2023 is NEAR, 4 years ago
0

I see that you have sorted the array $$$b$$$ too. You can't really do that because the order of elements in $$$b$$$ is important. The operations are happening in sequential order.

On Nanako → Good Bye 2022: 2023 is NEAR, 4 years ago
+4

You don't even need to use a set or priority queue actually. Since the constraints are very loose $$$(n, m \le 100)$$$, one can simply sort the array $$$a$$$ after every replacement of $$$a$$$'s smallest number, i.e., a[0] with b[j]

0

Shoot 4 times at the middle wall