[20250801] BOJ / P4 / XOR / 이종환 #590
Merged
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/14245
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
수열이 주어 졌을 때 두 가지 연산을 할 수 있다.
특정 구간 [a, b]에 c를 xor한다.
a번째 원소의 값을 출력한다.
초기 수열과 연산의 정보가 주어졌을 때, 그에 맞게 출력하라.
🔍 풀이 방법
세그먼트 트리 재활용 문제였다. 단 제일 기본이 되는 업데이트 값을 더하고 빼는 형식이 아닌, XOR 연산을 하는 것이었다. 다행이 XOR 연산은 교환법칙이 성립하기에, lazy[] 내에 들어있는 녀석들 끼리 연산을 미리 진행하면 된다.
⏳ 회고
세그먼트는 맨날 풀고 까먹고 풀고 까먹고...