#K40392. Knowledge Levels in a Circular Arrangement

    ID: 26632 Type: Default 1000ms 256MiB

Knowledge Levels in a Circular Arrangement

Knowledge Levels in a Circular Arrangement

You are given a circle of n employees, numbered from 1 to n. Among them, m employees are considered as the most knowledgeable. Their IDs are given in an array, along with an associated visibility gap for each. The visibility gap conceptually represents the number of employees an expert can observe before another expert appears in the circle.

Your task is to assign each of the m experts a unique knowledge level (ranging from 1 to m) based on the order of their IDs when sorted in increasing order, while the rest of the employees are assigned the highest knowledge level, n.

Formally, let the function be defined as:

$$compute\_knowledge\_levels(n, m, most\_knowledgeable\_ids, visibility\_gap) $$

It should return an array of n integers where the i-th element represents the knowledge level of the employee with ID i.

Note: The information regarding the visibility gap is provided along with the expert IDs, but for this problem it is only used to record the expert's associated data and does not affect the ordering.

Examples:

Input:
8 3
1 5 7
2 4 2

Output:
1 8 8 8 2 8 3 8

Input:
5 2
2 5
3 1

Output:
5 1 5 5 2

inputFormat

The first line contains two integers n and m, representing the total number of employees and the number of most knowledgeable employees respectively.

The second line contains m space-separated integers representing the IDs of the most knowledgeable employees.

The third line contains m space-separated integers representing the visibility gap values associated with each expert.

outputFormat

Output a single line with n space-separated integers, where the i-th integer is the knowledge level of the employee with ID i.

## sample
8 3
1 5 7
2 4 2
1 8 8 8 2 8 3 8