본문 바로가기 메뉴 바로가기

robustflame의 블로그

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

robustflame의 블로그

검색하기 폼
  • 분류 전체보기 (15)
    • 알고리즘 이론 (6)
    • 알고리즘 문제 풀이 (9)
  • 방명록

Fenwick Tree (1)
CF 785E Anton and Permutation

문제링크 - http://codeforces.com/problemset/problem/785/E문제 풀이순열 \(a[ \ ] = \{1, 2, ..., n\} \ (1 \le n \le 200000)\) 에 대하여 특정 위치 \(l_i\) 과 \(r_i\) 의 값을 바꾸는 연산이 \(q \ (1 \le q \le 50000)\) 번 수행될 때, 매 연산 후 순열에 존재하는 역접(inversion)의 수를 세는 문제다. 역접의 수는 크기가 \(a[x] > a[y] \ (x a[r]\) 이면 역접의 수가 1 감소한다. 위의 내용들에서 서로 상쇄되는 것들을 제거하고, 통합하면 아래와 같이 간결하게 역접의 수 변화를 확인할 수 있다. \(a[l] < a[r]\) 이면, \((l 0) { ret += tree[p..

알고리즘 문제 풀이 2017. 3. 27. 20:37
이전 1 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • greedy
  • branch and bound
  • pattern matching
  • Segment Tree
  • Square root decomposition
  • sort
  • math
  • Data structure
  • parametric search
  • search
  • sliding window
  • Graph
  • Heap
  • karatsuba
  • Minimum Spanning Tree
  • BFS
  • divide and conquer
  • Strings
  • suffix array
  • Binary search
  • constructive algorithms
  • Fenwick Tree
  • Dynamic Programming
  • tree
  • kmp search
  • implementation
more
«   2025/08   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바