CF920C Swap Adjacent Elements
题目描述
You have an array $ a $ consisting of $ n $ integers. Each integer from $ 1 $ to $ n $ appears exactly once in this array.
For some indices $ i $ ( $ 1
输入格式
第一行一个整数 n (2≤n≤200000)
第二行 n个整数 a1,a2,⋯,an(1≤ai≤200000) 。每个 1 到 n 间的整数正好出现一次。
第三行一个字符串,只包含 0 或者 1 。如果第 i个字符是1 ,你就可以把 ai与 ai+1交换。
输出格式
如果可以排序,输出 YES,否则输出 NO。
感谢@小粉兔 提供的翻译
说明/提示
In the first example you may swap $ a_{3} $ and $ a_{4} $ , and then swap $ a_{4} $ and $ a_{5} $ .