일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- 맵
- 누적 합
- 플로이드-워셜
- 트리
- 문자열
- DP
- 슬라이딩 윈도우
- 투 포인터
- boj
- 13164
- DFS
- BFS
- 구현
- 그래프
- 정렬
- 세그먼트 트리
- JavaScript
- 이분 탐색
- 수학
- 해시 테이블
- 브루트포스
- 2357
- 애드 혹
- 모던 JavaScript 튜토리얼
- 에라토스테네스의 체
- Python
- 싸피
- 정수론
- 그리디
- SSAFY
- Today
- Total
목록세그먼트 트리 (2)
흙금이네 블로그

아이디어 세그먼트 트리로 구간 내 최솟값과 인덱스를 저장해두고 변경이나 출력이 필요한 구간에 대해 빠르게 처리한다. 풀이 #1 (Python) import sys input = sys.stdin.readline INF = int(1e9) def solution(): def minimum(s, e): min_val = tree[s] while s >= 1 e >>= 1 return min_val[1] def modify(idx): while idx > 1: if tree[idx] >1] = tree[idx] else: tree[idx>>1] = tree[idx^1] idx >>= 1 N = int(input()) n = 1 while n < N: n *= 2 tr..

아이디어 세그먼트 트리로 구간 내 최솟값을 저장해두고 변경이나 출력이 필요한 구간에 대해 빠르게 처리한다. 풀이 #1 (Python) import sys input = sys.stdin.readline INF = int(1e9) def solution(): def minimum(s, e): min_val = tree[s] while s >= 1 e >>= 1 return min_val def modify(idx): while idx > 1: if tree[idx] >1] = tree[idx] else: tree[idx>>1] = tree[idx^1] idx >>= 1 N = int(input()) n = 1 while n < N: n *= 2 tree = [IN..