Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Oct 13, 2025

🧷 문제 링크

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

🧭 풀이 시간

20분

👀 체감 난이도

✏️ 문제 설명

길이 N인 수열 A에서 max(A[i], ..., A[j]) - min(A[i], ..., A[j]) <= T를 만족하는 j-i+1의 최댓값을 구해보자.

🔍 풀이 방법

  • 투 포인터

문제에 써있는 조건을 그대로 써서 투 포인터를 돌리면 된다.
구간 max와 min을 구할 때는 세그먼트 트리로 구했다.

⏳ 회고

처음엔 multiset으로 max, min을 구했는데 메모리 초과가 남.
세그먼트 트리로 겨우 뚫긴 했는데 덱을 쓰면 널널하게 통과가 됨.
왜 덱을 떠올리지 못했지?

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