Pat Pat
Time limit1sMemory limit256 MB
After point swaps in an array, answer queries asking whether a subarray is nondecreasing.
- Level
Medium6 of 10
- Topics
- Segment tree, Array
- Solved
- No attempts yet
Problem
freshmen joined KAIST. They are numbered 1 to , and person has height . At the start the freshmen stand in one line in order of their numbers.
Kang Hanpil wants to pat the freshmen times. On one pat he pats everyone from person to person . and change on every pat.
He wants every pat to be gentle, so for each integer with he wants the height of person to be no smaller than the height of person . If even one such fails that, Kang Hanpil gets angry on that pat. When there is no to check, so he does not get angry.
Some freshmen want to be patted and some do not, so between the pats person and person swap places times. and can change on every swap.
Given the number of freshmen and their heights, the pats, and the swaps, print whether Kang Hanpil gets angry on each pat.
Input
The first line contains () and (), separated by a space.
The second line contains integers (), the heights.
Each of the next lines contains three natural numbers , , , separated by spaces. ( is 1 or 2, and .)
means Kang Hanpil pats everyone from person to person . means person and person swap places.
Output
Print lines.
On line , print HSS090 if Kang Hanpil gets angry on his -th pat, and CS204 if he does not.