Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/30573
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
17명의 학생을 각각 알파벳 a부터 q까지로 나타낸다.
N개의 동아리가 주어지고, 각 동아리에 속한 학생들이 문자열 p[i]로 주어진다.
학생들의 상담 일정을 나타내는 문자열 Q가 주어진다.
Q의 구간 [a,b]에 속한 모든 학생들을 모아서 상담을 할 때, N개의 동아리 중 적어도 하나의 동아리에 속한 학생들이 모두 포함되도록 하는 구간의 개수를 구해보자.
🔍 풀이 방법
어떤 학생 집합 s가 적어도 하나의 동아리에 속한 학생들이 모두 포함되어 있다고 가정하자. 그리고 이를 f[s] = 1이라고 두자.
그러면 s & t = s인 모든 t에 대해 f[t] = 1이다.
->
백트래킹으로 f값이 1이 되는 모든 집합들을 구한다.이후, 일정 문자열에서
투 포인터로 f가 1인 구간을 세준다.⏳ 회고
ez