Status:  Past  Start:  20160409 10:00:00  End:  20160409 14:00:00 
Liga Cubana de Programación 2016 (Etapa III  OPEN)
Problem
3590  Gambling With Anders III
Created by  Luis Manuel Díaz Barón 
Added by  luismo (20160328) 
Limits 
Total Time: 20000 MS

Test Time:
4000 MS
Memory: 512 MB  Output: 64 MB  Size:
9 KB

Enabled languages  
Available in 
Description
Anders The Cat has invented a new game which he will present to Gambling Association, so it can be used in some gambling houses. The game is described below:
We define an Nalphabet as a permutation of N (1 <= N <= 36) different symbols taken from the English Alphabet (lower case only) and digits from 0 to 1. Note that the English Alphabet is an Nalphabet itself.
A rotation to the left is to take the leftmost (first one) character on the Alphabet and place it at the end of it, similarly a rotation to the right is to take the rightmost (last one) character on the Alphabet and place it at the beginning of it.
Now Anders the Cat and Peter the Mouse play the game; they take turns, Anders is always first. On each turn Anders rotates the alphabet right R (1 <= R <= 10^6) times, while Peter rotates the alphabet left L (1 <= L <= 10^6) times. The goal of this game is not important, but during the rounds they consume an entire bottle of Guayabita del Pinar, which leads to a partial state of blindness in each animal, there for once they finish their game, it would be amazing if you could print the final state of the Alphabet.
Anders The Cat has invented a new game which he will present to Gambling Association, so it can be used in some gambling houses. The game is described below:
We define an Nalphabet as a permutation of N (1 <= N <= 36) different symbols taken from the English Alphabet (lower case only) and digits from 0 to 1. Note that the English Alphabet is an Nalphabet itself.
A rotation to the left is to take the leftmost (first one) character on the Alphabet and place it at the end of it, similarly a rotation to the right is to take the rightmost (last one) character on the Alphabet and place it at the beginning of it.
Now Anders the Cat and Peter the Mouse play the game; they take turns, Anders is always first. On each turn Anders rotates the alphabet right R (1 <= R <= 10^6) times, while Peter rotates the alphabet left L (1 <= L <= 10^6) times. The goal of this game is not important, but during the rounds they consume an entire bottle of Guayabita del Pinar, which leads to a partial state of blindness in each animal, there for once they finish their game, it would be amazing if you could print the final state of the Alphabet.
Anders The Cat has invented a new game which he will present to Gambling Association, so it can be used in some gambling houses. The game is described below:
We define an Nalphabet as a permutation of N (1 <= N <= 36) different symbols taken from the English Alphabet (lower case only) and digits from 0 to 1. Note that the English Alphabet is an Nalphabet itself.
A rotation to the left is to take the leftmost (first one) character on the Alphabet and place it at the end of it, similarly a rotation to the right is to take the rightmost (last one) character on the Alphabet and place it at the beginning of it.
Now Anders the Cat and Peter the Mouse play the game; they take turns, Anders is always first. On each turn Anders rotates the alphabet right R (1 <= R <= 10^6) times, while Peter rotates the alphabet left L (1 <= L <= 10^6) times. The goal of this game is not important, but during the rounds they consume an entire bottle of Guayabita del Pinar, which leads to a partial state of blindness in each animal, there for once they finish their game, it would be amazing if you could print the final state of the Alphabet.
Input specification
In the first line a single integer N, the number of symbols of the alphabet.The second line contains a string of length N, the Nalphabet. The third line contains a single integer T (1 <= T <= 10^6), the number of turns to be taken. Each turn consists of two lines, the first one contains the value L, while the second contains the value R (0 <= L, R <= 10^6). The next 2 * T lines describe a turn.
In the first line a single integer N, the number of symbols of the alphabet.The second line contains a string of length N, the Nalphabet. The third line contains a single integer T (1 <= T <= 10^6), the number of turns to be taken. Each turn consists of two lines, the first one contains the value L, while the second contains the value R (0 <= L, R <= 10^6). The next 2 * T lines describe a turn.
In the first line a single integer N, the number of symbols of the alphabet.The second line contains a string of length N, the Nalphabet. The third line contains a single integer T (1 <= T <= 10^6), the number of turns to be taken. Each turn consists of two lines, the first one contains the value L, while the second contains the value R (0 <= L, R <= 10^6). The next 2 * T lines describe a turn.
Output specification
Print a string in a single line: the alphabet after all rotations.
Print a string in a single line: the alphabet after all rotations.
In the first line a single integer N, the number of symbols of the alphabet.The second line contains a string of length N, the Nalphabet. The third line contains a single integer T (1 <= T <= 10^6), the number of turns to be taken. Each turn consists of two lines, the first one contains the value L, while the second contains the value R (0 <= L, R <= 10^6). The next 2 * T lines describe a turn.
Sample input
5asdfg423113251
Sample output
gasdf
Hint(s)
http://coj.uci.cu/contest/
http://coj.uci.cu/contest/
http://coj.uci.cu/contest/