#P4658. A Simple Task
A Simple Task
A Simple Task
题面翻译
题目大意: 给定一个长度不超过10^5的字符串(小写英文字母),和不超过50000个操作。
每个操作 L R K 表示给区间[L,R]的字符串排序,K=1为升序,K=0为降序。
最后输出最终的字符串。
题目描述
This task is very simple. Given a string of length and queries each query is on the format which means sort the substring consisting of the characters from to in non-decreasing order if or in non-increasing order if .
Output the final string after applying the queries.
输入格式
The first line will contain two integers ( , ), the length of the string and the number of queries respectively.
Next line contains a string itself. It contains only lowercase English letters.
Next lines will contain three integers each ( , ).
输出格式
Output one line, the string after applying the queries.
样例 #1
样例输入 #1
10 5
abacdabcda
7 10 0
5 8 1
1 4 0
3 6 0
7 10 1
样例输出 #1
cbcaaaabdd
样例 #2
样例输入 #2
10 1
agjucbvdfk
1 10 1
样例输出 #2
abcdfgjkuv
提示
First sample test explanation: