CF342B.Xenia and Spies

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Xenia the vigorous detective faced nn (n>=2)(n>=2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to nn from left to right.

Spy ss has an important note. He has to pass the note to spy ff . Xenia interrogates the spies in several steps. During one step the spy keeping the important note can pass the note to one of his neighbours in the row. In other words, if this spy's number is xx , he can pass the note to another spy, either x1x-1 or x+1x+1 (if x=1x=1 or x=nx=n , then the spy has only one neighbour). Also during a step the spy can keep a note and not pass it to anyone.

But nothing is that easy. During mm steps Xenia watches some spies attentively. Specifically, during step tit_{i} (steps are numbered from 1) Xenia watches spies numbers li,li+1,li+2,...,ril_{i},l_{i}+1,l_{i}+2,...,r_{i} (1<=li<=ri<=n)(1<=l_{i}<=r_{i}<=n) . Of course, if during some step a spy is watched, he can't do anything: neither give the note nor take it from some other spy. Otherwise, Xenia reveals the spies' cunning plot. Nevertheless, if the spy at the current step keeps the note, Xenia sees nothing suspicious even if she watches him.

You've got ss and ff . Also, you have the steps during which Xenia watches spies and which spies she is going to watch during each step. Find the best way the spies should act in order to pass the note from spy ss to spy ff as quickly as possible (in the minimum number of steps).

输入格式

The first line contains four integers nn , mm , ss and ff (1<=n,m<=105; 1<=s,f<=n; sf; n>=2)(1<=n,m<=10^{5}; 1<=s,f<=n; s≠f; n>=2) . Each of the following mm lines contains three integers ti,li,rit_{i},l_{i},r_{i} (1<=ti<=109,1<=li<=ri<=n)(1<=t_{i}<=10^{9},1<=l_{i}<=r_{i}<=n) . It is guaranteed that t_{1}<t_{2}<t_{3}<...<t_{m} .

输出格式

Print kk characters in a line: the ii -th character in the line must represent the spies' actions on step ii . If on step ii the spy with the note must pass the note to the spy with a lesser number, the ii -th character should equal "L". If on step ii the spy with the note must pass it to the spy with a larger number, the ii -th character must equal "R". If the spy must keep the note at the ii -th step, the ii -th character must equal "X".

As a result of applying the printed sequence of actions spy ss must pass the note to spy ff . The number of printed characters kk must be as small as possible. Xenia must not catch the spies passing the note.

If there are miltiple optimal solutions, you can print any of them. It is guaranteed that the answer exists.

输入输出样例

  • 输入#1

    3 5 1 3
    1 1 2
    2 2 3
    3 3 3
    4 1 1
    10 1 3
    

    输出#1

    XXRR
    
首页