CF379B.New Year Present

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The New Year is coming! That's why many people today are busy preparing New Year presents. Vasily the Programmer is no exception.

Vasily knows that the best present is (no, it's not a contest) money. He's put nn empty wallets from left to right in a row and decided how much money to put in what wallet. Vasily decided to put aia_{i} coins to the ii -th wallet from the left.

Vasily is a very busy man, so the money are sorted into the bags by his robot. Initially, the robot stands by the leftmost wallet in the row. The robot can follow instructions of three types: go to the wallet that is to the left of the current one (if such wallet exists), go to the wallet that is to the right of the current one (if such wallet exists), put a coin to the current wallet. Due to some technical malfunctions the robot cannot follow two "put a coin" instructions in a row.

Vasily doesn't want to wait for long, so he wants to write a program for the robot that contains at most 10610^{6} operations (not necessarily minimum in length) the robot can use to put coins into the wallets. Help him.

输入格式

The first line contains integer nn (2<=n<=300)(2<=n<=300) — the number of wallets. The next line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} (0<=ai<=300)(0<=a_{i}<=300) .

It is guaranteed that at least one aia_{i} is positive.

输出格式

Print the sequence that consists of kk (1<=k<=106)(1<=k<=10^{6}) characters, each of them equals: "L", "R" or "P". Each character of the sequence is an instruction to the robot. Character "L" orders to move to the left, character "R" orders to move to the right, character "P" orders the robot to put a coin in the wallet. The robot is not allowed to go beyond the wallet line. In other words, you cannot give instructions "L" if the robot is at wallet 1, or "R" at wallet nn .

As a result of the performed operations, the ii -th wallet from the left must contain exactly aia_{i} coins. If there are multiple answers, you can print any of them.

输入输出样例

  • 输入#1

    2
    1 2
    

    输出#1

    PRPLRP
  • 输入#2

    4
    0 2 0 2
    

    输出#2

    RPRRPLLPLRRRP
首页