일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 해시 테이블
- 정수론
- 2357
- 누적 합
- 문자열
- 트리
- DP
- 맵
- 플로이드-워셜
- 브루트포스
- 에라토스테네스의 체
- BFS
- SSAFY
- boj
- 싸피
- 슬라이딩 윈도우
- JavaScript
- 그리디
- 이분 탐색
- 애드 혹
- 13164
- DFS
- 그래프
- 세그먼트 트리
- 수학
- 모던 JavaScript 튜토리얼
- Python
- 투 포인터
- 구현
- 정렬
- 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..