A9881. A Simple Task
编程题
普及/提高-
知识点
题目描述
This task is very simple. Given a string $S$ of length $n$ and $q$ queries each query is on the format $i$ $j$ $k$ which means sort the substring consisting of the characters from $i$ to $j$ in non-decreasing order if $k=1$ or in non-increasing order if $k=0$ .
Output the final string after applying the queries.
这项任务非常简单。给定长度为 n 的字符串 S 和 q 查询,每个查询的格式为 i j k 这意味着,如果是 k = 1 ,则对由 i 至 j 字符组成的子串进行非递减排序;如果是 k = 0 ,则对由 i 至 j 字符组成的子串进行非递增排序。
应用查询后输出最终字符串。
Output the final string after applying the queries.
这项任务非常简单。给定长度为 n 的字符串 S 和 q 查询,每个查询的格式为 i j k 这意味着,如果是 k = 1 ,则对由 i 至 j 字符组成的子串进行非递减排序;如果是 k = 0 ,则对由 i 至 j 字符组成的子串进行非递增排序。
应用查询后输出最终字符串。
输入格式
The first line will contain two integers $n,q$ ( $1<=n<=10^{5}$ , $0<=q<=50000$ ), the length of the string and the number of queries respectively.
Next line contains a string $S$ itself. It contains only lowercase English letters.
Next $q$ lines will contain three integers each $i,j,k$ ( $1<=i<=j<=n$ , ).
输入
第一行将包含两个整数 $n,q$ ( $1<=n<=10^{5}$ , $0<=q<=50000$ ),分别是字符串长度和查询次数。
下一行包含一个字符串 S 。它只包含小写英文字母。
接下来的 q 行将分别包含三个整数$i,j,k$ ( $1<=i<=j<=n$ , ).
Next line contains a string $S$ itself. It contains only lowercase English letters.
Next $q$ lines will contain three integers each $i,j,k$ ( $1<=i<=j<=n$ , ).
输入
第一行将包含两个整数 $n,q$ ( $1<=n<=10^{5}$ , $0<=q<=50000$ ),分别是字符串长度和查询次数。
下一行包含一个字符串 S 。它只包含小写英文字母。
接下来的 q 行将分别包含三个整数$i,j,k$ ( $1<=i<=j<=n$ , ).
输出格式
Output one line, the string $S$ after applying the queries.
输出
应用查询后输出一行字符串 S 。
输出
应用查询后输出一行字符串 S 。
输入输出样例
输入 #1
10 5 abacdabcda 7 10 0 5 8 1 1 4 0 3 6 0 7 10 1
输出 #1
cbcaaaabdd
输入 #2
10 1 agjucbvdfk 1 10 1
输出 #2
abcdfgjkuv
说明/提示
First sample test explanation:
第一个样本测试说明:





第一个样本测试说明:




