Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Oct 20, 2025

🧷 문제 링크

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

🧭 풀이 시간

30분

👀 체감 난이도

✏️ 문제 설명

집합 A, B에 대해 다음 쿼리를 수행해보자.

  • add A S : A에 문자열 S를 추가
  • delete A S : A에서 문자열 S를 제거
  • add B S : B에 문자열 S를 추가
  • delete B S : B에서 문자열 S를 제거
  • find S : A의 원소의 접두사와 B의 원소의 접미사를 이어 붙여 S가 되는 경우의 수를 출력

🔍 풀이 방법

A에는 S의 모든 접두사를 다 넣어놓고, B에는 S의 모든 접미사를 다 넣어놓는다.
제거 연산 시에도 각각에서 모든 접두/접미사를 제거한다.
이때, 중복 원소가 생길 수 있으니까 multiset을 사용했다.
find 연산에서는 S의 모든 접두사와 접미사에 대해 A, B에서 존재하는 개수를 세서 계산했다.

⏳ 회고

C++만세

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