CF558E.A Simple Task
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 字符组成的子串进行非递增排序。
应用查询后输出最终字符串。
输入格式
The first line will contain two integers n,q ( 1<=n<=105 , 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<=105 , 0<=q<=50000 ),分别是字符串长度和查询次数。
下一行包含一个字符串 S 。它只包含小写英文字母。
接下来的 q 行将分别包含三个整数i,j,k ( 1<=i<=j<=n , ).
输出格式
Output one line, the string S after applying the queries.
输出
应用查询后输出一行字符串 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:
第一个样本测试说明: