#K12446. Array Element Incrementer
Array Element Incrementer
Array Element Incrementer
You are given three inputs:
- An integer \( n \) representing the size of an array that is initially filled with zeros.
- An integer \( t \) representing the number of positions to increment.
- A list of \( t \) space-separated integers representing the positions in the array (using 1-indexing) that need to be incremented by 1.
The task is to create the array, then for each position \( pos \) in the given list, if \( 1 \le pos \le n \), increment the element at index \( pos-1 \) by 1. Finally, output the modified array.
Note: Positions that are less than 1 or greater than \( n \) should be ignored.
inputFormat
The input is given via standard input (stdin) in the following format:
n t pos1 pos2 ... post
Here, the first line contains an integer \( n \), the second line contains an integer \( t \), and the third line contains \( t \) space-separated integers denoting the positions.
outputFormat
Print the modified array on a single line. The elements must be separated by a single space.
## sample5
3
1 3 5
1 0 1 0 1
</p>