#P11894. 「LAOI-9」Update
「LAOI-9」Update
Problem Description
Given a sequence of length , there are operations. Each operation is as follows:
- Given , for , set .
After all operations, output the sequence .
Input Format
The first line contains two positive integers and .
The next line contains positive integers, where the -th number is .
The next lines each contain two positive integers and .
Output Format
Output one line with positive integers, where the -th number is . Adjacent integers are separated by spaces.
5 2
2 3 4 5 6
2 3
1 1
3 4 6 5 6
Hint
This problem uses bundled testdata.
| Subtask ID | Special Property | Score | |
|---|---|---|---|
| None | |||
| A | |||
| None |
Special property A: .
For of the testdata, , , and .
Translated by ChatGPT 5