시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 101 35 31 43.662%

문제

옛날 옛적, 일곱 언덕과 일곱 바다를 건너 작은 마을이 있었어요. 백설공주는 놀고 먹고 자다가 일어나서 문명 5, 리그 오브 레전드, 풋볼 매니저를 하다가 다시 자는 난쟁이들 N명과 살고 있었어요. 계속되는 이런 생활에 진저리가 난 백설공주는 난쟁이들에게 고통을 주기로 결심했고, 체육 수업을 빙자한 얼차려를 주기로 했답니다!

수업이 시작할 때, 난쟁이들은 키가 큰 순서로 한 줄로 서 있어야 돼요. 신기하게도 난쟁이들 중 키가 같은 사람은 한명도 없었고, 정확하게 1, 2, ... , Ncm의 키를 가지고 있었어요. 하지만, 난쟁이들의 머리는 계속되는 트롤링으로 인해 피폐해져 있었고, 자기들끼리 키를 비교해 한 줄로 설만큼의 지능조차 없었답니다. 그래서 백설공주는 다음 명령을 통해 난쟁이들을 조종하기로 했어요.

  • 1 X Y -- X번째 위치와 Y번째 위치에 있는 난쟁이 둘이 위치를 바꾸도록 합니다.또 백설공주는 다음 명령으로 난쟁이들이 줄 서있는 순서를 살펴봅니다.

또 백설공주는 다음 명령으로 난쟁이들이 제대로 서 있는지를 확인해요.

  • 2 A B -- A, A+1, ..., Bcm의 키를 가진 난쟁이들이 모두 이웃해 서 있는지 확인합니다(꼭 A, A+1, ..., B 순서일 필요는 없습니다).

멍청한 난쟁이들이 백설공주가 시키는대로 잘 따르게 도와줘 더 이상 백설공주가 화나지 않게 해주세요!

입력

입력의 첫 번째 줄에 난쟁이들의 인원수 N과 백설공주가 명령하는 횟수 M이 주어집니다.(2 ≤ N ≤ 200 000, 2 ≤ M ≤ 200 000).

다음 줄에는 난쟁이들이 처음에 서 있는 순서를 나타내는 N개의 자연수가 주어집니다(자연수의 범위는 1부터 N까지이며, 한 숫자는 한번만 주어집니다).

다음 M개의 줄에는 백설공주의 명령이 주어지는데, 

"1 X Y" (1 ≤ X, Y ≤N, X ≠ Y) 또는

“2 A B” (1 ≤ A ≤ B ≤ N) 꼴로 주어지고 그 의미는 위에서 설명한 바와 같습니다.

출력

출력엔 2번째 형태의 백설공주의 명령에 대한 대답을 "YES"나 "NO"로 한 줄에 한번씩 출력합니다.

예제 입력 1

5 3
2 4 1 3 5
2 2 5
1 3 1
2 2 5

예제 출력 1

NO
YES
W3sicHJvYmxlbV9pZCI6IjU4MTciLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWFjZTBcdWQxYjVcdWJjMWJcdWIyOTQgXHViMDljXHVjN2MxXHVjNzc0XHViNGU0IiwiZGVzY3JpcHRpb24iOiI8cD5cdWM2MWJcdWIwYTAgXHVjNjFiXHVjODAxLCBcdWM3N2NcdWFjZjEgXHVjNWI4XHViMzU1XHVhY2ZjIFx1Yzc3Y1x1YWNmMSBcdWJjMTRcdWIyZTRcdWI5N2MgXHVhYzc0XHViMTA4IFx1Yzc5MVx1Yzc0MCBcdWI5YzhcdWM3NDRcdWM3NzQgXHVjNzg4XHVjNWM4XHVjNWI0XHVjNjk0LiBcdWJjMzFcdWMxMjRcdWFjZjVcdWM4ZmNcdWIyOTQgXHViMTgwXHVhY2UwIFx1YmEzOVx1YWNlMCBcdWM3OTBcdWIyZTRcdWFjMDAgXHVjNzdjXHVjNWI0XHViMDk4XHVjMTFjIFx1YmIzOFx1YmE4NSA1LCBcdWI5YWNcdWFkZjggXHVjNjI0XHViZTBjIFx1YjgwOFx1YzgwNFx1YjRkYywgXHVkNDhiXHViY2ZjIFx1YjllNFx1YjJjOFx1YzgwMFx1Yjk3YyBcdWQ1NThcdWIyZTRcdWFjMDAgXHViMmU0XHVjMmRjIFx1Yzc5MFx1YjI5NCBcdWIwOWNcdWM3YzFcdWM3NzRcdWI0ZTQgTlx1YmE4NVx1YWNmYyBcdWMwYjRcdWFjZTAgXHVjNzg4XHVjNWM4XHVjNWI0XHVjNjk0LiBcdWFjYzRcdWMxOGRcdWI0MThcdWIyOTQgXHVjNzc0XHViN2YwIFx1YzBkZFx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