Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Nov 25, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/12741

🧭 풀이 시간

20분

👀 체감 난이도

✏️ 문제 설명

N명이 사람이 일렬로 서 있고, 각 사람의 키는 A[i]이다.
두 종류의 쿼리를 Q개 처리해보자.

  • 1 L R : L번 사람부터 R번 사람까지 쓰다듬는다. L <= i < R인 i에 대해, A[i] <= A[i+1]이면 CS204를, 아니면 HSS090을 출력한다.
  • 2 L R : L번 사람과 R번 사람이 위치를 바꾼다.

🔍 풀이 방법

세그먼트 트리로 인접한 사람이 A[i] <= A[i+1]을 만족한다면 0, 아니라면 1을 기록하여 구간 합을 관리하고, 쓰다듬을 때는 구간 합이 0인지 아닌지로 판별한다.

⏳ 회고

ez

@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Nov 25, 2025
@ShinHeeEul ShinHeeEul merged commit a9d372e into main Nov 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants