#C7714. Flash Sale Customer Selection
Flash Sale Customer Selection
Flash Sale Customer Selection
You are given a flash sale scenario where each sale event has a limited number of items available. For each test case, you are provided with the number of available items and a sequence of customer attempts (represented by customer IDs) to purchase the item. Each customer may attempt more than once, but only the first unique attempt counts. The task is to determine, for each sale event, which customers successfully purchased an item, in the order of their first appearance, stopping once the available items are exhausted.
Note: Let \(N\) be the number of available items in a flash sale and \(M\) be the number of customer attempts. You are required to collect up to \(N\) unique customers from the list of attempts.
inputFormat
The input is provided via standard input (stdin). The first line contains an integer (T) representing the number of test cases. For each test case:
- The first line contains two integers (N) and (M), where (N) is the number of available items and (M) is the number of customer attempts.
- The second line contains (M) integers separated by spaces, representing the customer IDs attempting to purchase the item. If (M) is zero, the second line will be empty.
outputFormat
For each test case, output a single line on standard output (stdout). If at least one customer successfully purchased an item, print their unique IDs (in the order they appear in the attempts) separated by a single space. If no customer could purchase an item (or if the list is empty), print "No Sales".## sample
3
5 7
1 2 3 4 5 6 7
3 5
10 20 10 30 20
2 2
100 200
1 2 3 4 5
10 20 30
100 200
</p>