시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 89 | 34 | 29 | 35.366% |
Let A be a sequence of N elements. You can perform two types of operations on this sequence:
Determine a sequence of operations such that sequence A becomes another given sequence B (of also N elements). The number of operations must be less or equal than 2 ∗ N.
The first line of the input contains a single number N. The second line contains A, a sequence of N elements. The third line contains B, another sequence of N elements.
If there is no solution such that sequence A becomes B, print –1. Otherwise, print on the first line a single number x, the minimum number of operations needed to transform sequence A in B. Each of the next x lines will contain a character (the type of the operation: m if the operation use the minimum and M for the maximum) and an interval (a, b), describing the operations needed for the process. If there are multiple solutions, print any of them.
5 1 5 5 3 4 1 1 4 4 4
3 m 1 2 M 4 5 m 3 5
5 1 2 3 4 4 2 2 2 2 5
-1
ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2018 F번