2489 - I2P(II)2022_Yang_lab1 Scoreboard

Time

2022/03/11 13:20:00 2022/03/11 15:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13442 Lucky money 2

13442 - Lucky money 2   

Description

Receiving lucky money is the favorite activity of children during Chinese New Year.

Denny's family has N children, everyone wants to get the lucky money as soon as possible.

The elders in the family have prepared a game to decide the order of receiving the lucky money:

  • At the beginning, all children sit in a circle, with seats numbered from 1 to N.
  • Randomly decide two numbers A and K and the direction R/L, move the Ath youngest child K positions clockwise/counterclockwise.

For example:

N = 6

The given initial age sequence: 1 1 3 4 5 5

 

 

A = 3, K = 2, R

After processing:

 

 

A = 1, K = 3, L

After processing:

 

 

A = 1, K = 6, R

After processing:

 

 

A = 2, K = 2, R

After processing:

 

Output:
The age sequence in clockwise from the youngest: 1 3 5 4 5 1

Note: if two children have same age, consider the children with less order yonger.

 

Input

The first line contains two integers N M, the number of children and the number of position changes.

The second line contains N integers, giving the children's age sequence.

Each of the following M lines contains two integers A and K and the direction 'R' or 'L'.

 

test cases:

(3/8) 1 <= A <= N <= 100, 1 <= M, K <= 100, all children are different ages, and the age sequence is {1, 2, ..., N}. 
(3/8) 1 <= A <= N <= 5000, 1 <= M <= 50000, 1 <= K <= 100, all children are different agesand the age sequence is incremented.
(1/8) 1 <= A <= N <= 5000, 1 <= M <= 50000, 1 <= K <= 100, 
(1/8) 1 <= A <= N <= 500000, 1 <= M, K <= 2000.

Output

The output contains one line.

Output the age sequence of the children in clockwise from the youngest.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13442.c

Partial Judge Header

13442.h

Tags

The output contains 11111111111111111111



Discuss