CF1634E.Fair Share
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Even a cat has things it can do that AI cannot.
— Fei-Fei Li
You are given m arrays of positive integers. Each array is of even length.
You need to split all these integers into two equal multisets L and R , that is, each element of each array should go into one of two multisets (but not both). Additionally, for each of the m arrays, exactly half of its elements should go into L , and the rest should go into R .
Give an example of such a division or determine that no such division exists.
输入格式
The first line contains an integer m ( 1≤m≤105 ) — the number of arrays.
The next 2⋅m lines contain descriptions of the arrays.
For each array, the first line contains an even integer n ( 2≤n≤2⋅105 ) — the length of the array. The second line consists of n space-separated integers a1,a2,…,an ( 1≤ai≤109 ) — array elements.
It is guaranteed that the sum of n over all arrays does not exceed 2⋅105 .
输出格式
If the answer exists, print "YES", and then print m lines.
On each line, for each element, print the letter "L" or "R" (capitalized, without spaces), depending on which multiset the element should go into.
If there is no answer, print "NO" on the only line.
输入输出样例
输入#1
3 2 1 2 4 1 2 3 3 6 1 1 2 2 3 3
输出#1
YES RL LRLR RLLRRL
说明/提示
In the first array, we add the first element to R and the second to L . Now L={2} , and R={1} .
In the second array, we add the first and third elements to L and the rest to R . Now L={1,2,3} and R={1,2,3} .
In the third array, we add elements 2, 3, and 6 to L , and others — to R . As a result, L=R={1,1,2,2,3,3} .