/ https://42jerrykim.github.io/ _index.md
Avatar

42JerryKim

42는 'The Hitchhiker's Guide to the Galaxy'라는 SF 소설에서 삶, 우주, 그리고 모든 것에 대한 궁극적인 질문에 대한 해답이다.

  1. Home
  2. Collections
  3. Search
  4. Categories
  5. Tags
  6. Archives
    1. Dark Mode

Categories

Algorithm Vocabulary BOJ English Graph Movie Math Design Pattern Geometry CSharp

Tags

Documentation 문서화 Best-Practices Implementation 구현 Tutorial Code-Quality Testing Go Optimization 테스트 Education Guide 코드품질 가이드 최적화 교육 C++ Algorithm Technology

Archives

2026 153
2025 420
2024 178
2023 24
2022 79
More
Featured image of post [Algorithm] C++ 백준 14899번: 수열과 쿼리 19
Algorithm Segment Tree Segment Tree Beats

[Algorithm] C++ 백준 14899번: 수열과 쿼리 19

구간 덧셈, 구간 바닥 나눗셈(⌊Ai/d⌋), 구간 최솟값과 구간 합을 처리한다. min/max 기반 가지치기(일괄 set, 동일 delta add)로 floor-div 갱신을 세그먼트 트리 비츠로 최적화한다.

12월 19, 2025
5 minute read
Featured image of post [Algorithm] C++ 백준 15249번: Building Bridges
Algorithm BOJ DP Convex Hull Trick

[Algorithm] C++ 백준 15249번: Building Bridges

기둥 일부만 선택해 1번부터 n번까지 다리를 잇는다. 구간 연결 비용 (hi-hj)^2와 선택되지 않은 기둥 제거 비용 wi를 합쳐 최소화한다. DP를 세우고 Li Chao Tree로 O(n log H)에 최적화한다.

12월 19, 2025
2 minute read
Featured image of post [Algorithm] C++ 백준 16745번: What Goes Up Must Come Down
Algorithm BOJ Fenwick Tree

[Algorithm] C++ 백준 16745번: What Goes Up Must Come Down

인접 스왑만으로 수열을 비토닉(비감소 후 비증가) 형태로 재배열할 때 필요한 최소 스왑 수를 구한다. 각 원소를 좌/우 구간에 둘 때의 ‘큰 값과의 역전’ 비용을 Fenwick Tree로 계산해 값별 최적 분할을 합산한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 16895번: 님 게임 3
Algorithm BOJ Game-Theory Bitwise

[Algorithm] C++ 백준 16895번: 님 게임 3

전체 돌더미의 XOR(님합)이 0이면 선공은 필패다. 아니면 어떤 더미 pi를 pi^X로 줄여 님합을 0으로 만드는 모든 첫 수가 승리 수이며, 이를 O(N)으로 센다.

12월 19, 2025
2 minute read
Featured image of post [Algorithm] C++ 백준 17441번: 파리채 만들기
Algorithm BOJ Math Geometry Green's Theorem

[Algorithm] C++ 백준 17441번: 파리채 만들기

단순다각형 내부에서 두 점을 균일·독립으로 뽑을 때 E[|P-Q|^2]를 구한다. 이를 2(E[|P|^2]-|E[P]|^2)로 바꾸고 면적·무게중심·∫x^2,∫y^2를 변 합 공식으로 O(N)에 계산한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 1777번: 순열복원
Algorithm BOJ Data Structure Fenwick Tree Order Statistics

[Algorithm] C++ 백준 1777번: 순열복원

Inversion sequence(각 i 뒤에 나오며 i보다 작은 수의 개수)로부터 Fenwick Tree(BIT)에서 k번째 빈 칸을 찾아 큰 수부터 배치해 순열을 복원한다. O(N log N)으로 N≤100000을 처리한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 17965번: Absolute Game
Algorithm BOJ Game-Theory Greedy

[Algorithm] C++ 백준 17965번: Absolute Game

각자 자신의 배열에서 하나만 남길 때까지 번갈아 삭제한다. 게임 값은 max_x min_y |x-y|로 환원되며, b를 정렬한 뒤 각 a의 최근접 거리 최댓값을 lower_bound로 계산한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 20176번: Needle
Algorithm BOJ Math FFT Convolution Geometry

[Algorithm] C++ 백준 20176번: Needle

세 장벽(위·중·아래) 구멍 3점이 일직선이면 중간 x는 위·아래 x의 평균이다. 위/아래 좌표를 0/1 배열로 만든 뒤 FFT 컨볼루션으로 합=2xm 쌍을 세어 O(R log R)에 통로 개수를 구한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 20506번: Kaisar - 생존
Algorithm BOJ Tree LCA

[Algorithm] C++ 백준 20506번: Kaisar - 생존

트리에서 모든 순서쌍 (x,y)의 LCA를 모아 정렬한 뒤 홀수/짝수 위치 합을 구한다. 각 정점이 LCA가 되는 쌍의 개수를 서브트리 크기 제곱으로 O(N)에 계산한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 22878번: 간단한 문제
Algorithm BOJ Math Sorting

[Algorithm] C++ 백준 22878번: 간단한 문제

점 (p_i,q_i) 쌍에 대해 모든 i,j의 min(|p_i-p_j|,|q_i-q_j|) 합을 구한다. max(|dx|,|dy|)=(|dx+dy|+|dx-dy|)/2를 이용해 p,q,p+q,p-q를 정렬·누적합으로 처리한다.

12월 19, 2025
1 minute read
1 14 15 16 17 18 19 20 21 22 90
© 2018 - 2026 42JerryKim
Built with Hugo
Theme Stack designed by Jimmy