Codeforces Beta Round 74 (Div. 1 Only)
E
Fire and Ice
Codeforces
2900
原题
← D→
翻译中…

The Fire Lord attacked the Frost Kingdom. He has already got to the Ice Fortress, where the Snow Queen dwells. He arranged his army on a segment $*n*$ in length not far from the city walls. And only the frost magician Solomon can save the Frost Kingdom.

翻译中…

image

翻译中…

The $*n*$-long segment is located at a distance equal exactly to $1$ from the castle walls. It can be imaginarily divided into unit segments. On some of the unit segments fire demons are located — no more than one demon per position. Each demon is characterised by his strength - by some positive integer. We can regard the fire demons being idle.

翻译中…

Initially Solomon is positioned on the fortress wall. He can perform the following actions several times in a row:

翻译中…
  • "L" — Solomon shifts one unit to the left. This movement cannot be performed on the castle wall.
  • "R" — Solomon shifts one unit to the left. This movement cannot be performed if there's no ice block to the right.
  • "A" — If there's nothing to the right of Solomon, then Solomon creates an ice block that immediately freezes to the block that Solomon is currently standing on. If there already is an ice block, then Solomon destroys it. At that the ice blocks to the right of the destroyed one can remain but they are left unsupported. Those ice blocks fall down.
翻译中…

Solomon spends exactly a second on each of these actions.

翻译中…

As the result of Solomon's actions, ice blocks' segments fall down. When an ice block falls on a fire demon, the block evaporates and the demon's strength is reduced by $1$. When the demons' strength is equal to $0$, the fire demon vanishes. The picture below shows how it happens. The ice block that falls on the position with no demon, breaks into lots of tiny pieces and vanishes without hurting anybody.

翻译中…

image

翻译中…

Help Solomon destroy all the Fire Lord's army in minimum time.

翻译中…

Input

翻译中…

The first line contains an integer $*n*$ ($1 ≤ *n* ≤ 1000$). The next line contains $*n*$ numbers, the $*i*$-th of them represents the strength of the fire demon standing of the $*i*$-th position, an integer from $1$ to $100$. If there's no demon on the $*i*$-th position, then the $*i*$-th number equals to $0$. It is guaranteed that the input data have at least one fire demon.

翻译中…

Output

翻译中…

Print a string of minimum length, containing characters "L", "R" and "A" — the succession of actions leading to the required result.

翻译中…

If there are several possible answers, print any of them.

翻译中…

样例

Input #1
3
1 0 1
Output #1
ARARARALLLA
InputCopy OutputCopy
Input #2
3
0 2 0
Output #2
ARARALAARALA
InputCopy OutputCopy
题目信息
题号
89E
时间限制
0.5 s
内存限制
256 MB
标签
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。