Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Apr 4, 2025

🧷 문제 링크

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

🧭 풀이 시간

13분

👀 체감 난이도

✏️ 문제 설명

N개의 구역이 1번부터 N번까지 시계 방향을 이루며 원형으로 배치되어 있다.
도현이는 처음에 1번 구역에 서있다.
아래 쿼리를 수행하는 프로그램을 작성해보자.
image

🔍 풀이 방법

[사용한 알고리즘]

  • TreeSet
  • 이분 탐색

명소로 지정되어 있는 인덱스만 TreeSet에 존재하도록 관리한다.

1번 쿼리는 contains함수로 명소 여부를 판별해 remove 혹은 add로 처리할 수 있다.
2번 쿼리는 모듈로 연산으로 처리할 수 있다.
3번 쿼리는 TreeSet의 ceiling함수로 처리할 수 있다.

⏳ 회고

ceiling, floor, higher, lower 함수에 대해 새로 알게 되었다

@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Apr 4, 2025
@ShinHeeEul ShinHeeEul merged commit 91a6c2f into main Apr 4, 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