/ 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 BOJ Vocabulary Graph English Movie Math CSharp Data Structures Geometry

Tags

Implementation C++ Algorithm BOJ 백준 알고리즘 Cpp 구현 시간복잡도 Time Complexity Space Complexity 공간복잡도 Competitive Programming Optimization 최적화 Edge Cases 경쟁프로그래밍 코너 케이스 정당성 증명 Proof of Correctness

Archives

2025 419
2024 178
2023 24
2022 82
2021 25
More
Featured image of post [Algorithm] C++ 백준 12012번: Closing the Farm (Gold)
Algorithm BOJ Graph DSU Offline Query

[Algorithm] C++ 백준 12012번: Closing the Farm (Gold)

헛간을 하나씩 닫을 때마다 남아있는 헛간들이 모두 연결되는지 묻는다. 닫기 순서를 역으로 뒤집어 ‘열기’로 바꾸고 DSU로 열린 정점만 union해, 매 단계에 한 컴포넌트인지 O((N+M)α(N))에 판정한다.

12월 23, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 1258번: 문제 할당
Algorithm BOJ Graph Matching Hungarian Algorithm

[Algorithm] C++ 백준 1258번: 문제 할당

N명의 학생과 N개의 문제 비용 행렬이 주어질 때, 각 학생에게 서로 다른 문제를 배정해 총 시간을 최소화한다. 헝가리안 알고리즘으로 최소 비용 완전 매칭을 O(N^3)에 계산한다.

12월 23, 2025
3 minute read
Featured image of post [Python] Hugo 대표 이미지 자동 생성기(hero infographic) 사용법
Python Hugo Automation Blog

[Python] Hugo 대표 이미지 자동 생성기(hero infographic) 사용법

Pillow로 Hugo 포스트 대표 이미지를 자동 생성하는 `hero_infographic_generator.py` 사용법을 정리합니다. JSON 스펙으로 헤더·카드·푸터를 재사용하고, 5가지 예시로 바로 적용 가능한 워크플로우를 제공합니다.

12월 23, 2025
4 minute read
Featured image of post [Security] 프라이버시는 마케팅, 익명성은 아키텍처
Security Privacy Architecture

[Security] 프라이버시는 마케팅, 익명성은 아키텍처

‘프라이버시’가 약속과 약관에 머무는 순간, 데이터는 곧 취약점이 된다. Mullvad·Servury 사례로 ‘협조 불가능한’ 익명성 설계 원칙과 비용, 운영 현실의 충돌 지점을 정리한다.

12월 23, 2025
6 minute read
Featured image of post [Algorithm] C++ 백준 13028번: 민호의 소원
Algorithm BOJ Data Structure Fenwick Tree Offline Query

[Algorithm] C++ 백준 13028번: 민호의 소원

길이 N 수열에 대해 구간 [x,y]에서 3번 이상 등장한 서로 다른 값의 개수를 묻는다. 오른쪽 끝을 고정해 ‘세 번째로 최근 등장 위치’를 갱신하며 Fenwick Tree로 오프라인 처리해 O((N+Q)logN)에 답한다.

12월 22, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 13232번: Domain clusters
Algorithm BOJ Graph SCC Tarjan

[Algorithm] C++ 백준 13232번: Domain clusters

도메인 간 링크를 방향 그래프로 보고, ‘서로 도달 가능’한 최대 부분집합의 크기를 구한다. 상호 도달 가능 관계는 SCC로 분해되므로 Tarjan 알고리즘으로 모든 SCC를 찾고 최대 크기를 O(D+L)에 계산한다.

12월 22, 2025
3 minute read
Featured image of post [Movie] The Aviator (에비에이터) (2004) - 하워드 휴즈의 비행과 강박
Movie Biography Drama Aviation

[Movie] The Aviator (에비에이터) (2004) - 하워드 휴즈의 비행과 강박

스코세이지가 그린 하워드 휴즈의 1927~1947년: 헬스 엔젤스 제작, 기록 비행, TWA, 청문회까지. 비행의 집착이 OCD와 만나 천재를 고립으로 몰아넣는 올드 할리우드 대서사극.

12월 21, 2025
9 minute read
Featured image of post [Algorithm] C++ 백준 10050번: 블록
Algorithm BOJ Constructive Divide and Conquer

[Algorithm] C++ 백준 10050번: 블록

초기 BABABA…(길이 2N)을 인접한 2블록 이동으로 A^N B^N 형태로 만든다. 최소 N회가 하한이고, n=3~7 기저 + n-4 해를 평행이동하는 재귀로 정확히 N회를 구성한다.

12월 20, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 13543번: 수열과 쿼리 2
Algorithm BOJ Data Structure Treap Randomized BST Implicit Treap Binomial Theorem Polynomial

[Algorithm] C++ 백준 13543번: 수열과 쿼리 2

삽입/삭제/갱신이 있는 동적 수열에서 구간 다항 가중합을 구한다. implicit treap에 ΣAi·i^k(0≤k≤10)을 저장하고 이항정리로 merge 시 shift를 계산해 O(K^2 log N)으로 처리한다.

12월 20, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 17372번: 피보나치 수의 최대공약수의 합
Algorithm BOJ Number Theory Mobius Inversion Fibonacci

[Algorithm] C++ 백준 17372번: 피보나치 수의 최대공약수의 합

gcd(Fi,Fj)=F_gcd(i,j) 성질을 이용해 이중합을 Möbius 반전으로 Σ g(d)⌊n/d⌋²로 바꾸고, Mertens 함수 + 피보나치 fast doubling으로 n≤1e9을 처리한다.

12월 20, 2025
5 minute read
Featured image of post [Algorithm] C++ 백준 32231번: 재우의 삼수강
Algorithm BOJ Geometry Calculus Hyperbolic Geometry

[Algorithm] C++ 백준 32231번: 재우의 삼수강

밀도 ρ=1/y인 수영장에서 단위거리 이동 시간이 ρ초이므로, 총 시간은 ∫(ds/y)로 주어진다. 이는 상반평면 모델의 쌍곡거리이며 acosh(1+Δ/(2y1y2))로 최소 시간을 O(1)에 계산한다.

12월 20, 2025
2 minute read
Featured image of post [Algorithm] C++ 백준 3752번: 최대공약수 행렬식
Algorithm BOJ Number Theory Matrix Determinant

[Algorithm] C++ 백준 3752번: 최대공약수 행렬식

인수에 대해 닫힌 집합 S에서 gcd(xi,xj)로 만든 GCD 행렬의 행렬식은 Smith 정리에 의해 ∏_{x∈S} φ(x)로 단순화된다. 각 원소를 소인수분해해 오일러 피함수를 곱해 mod 1e9+7로 계산한다.

12월 20, 2025
3 minute read
Featured image of post [PowerShell] Frontmatter Description 누락 파일 찾기
PowerShell Hugo

[PowerShell] Frontmatter Description 누락 파일 찾기

Cursor/VSCode에서 멀티라인 frontmatter 검색의 한계를 극복하고, PowerShell만으로 description이 없는 마크다운 파일을 찾아내는 방법을 단계별로 안내합니다. draft:true 제외 로직과 정규식 설명 포함.

12월 20, 2025
5 minute read
Featured image of post [Algorithm] C++ 백준 1185번: 유럽여행
Algorithm BOJ Graph MST Kruskal

[Algorithm] C++ 백준 1185번: 유럽여행

도시 방문비와 도로 통행료가 있을 때 모든 도시를 최소 한 번 방문하고 시작점으로 돌아오는 최소 비용을 구한다. 간선 비용을 2L+Cu+Cv로 변형해 크루스칼 MST 후 최소 Cu를 더한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 13324번: BOJ 수열 2
Algorithm BOJ Greedy Priority Queue Data Structure

[Algorithm] C++ 백준 13324번: BOJ 수열 2

A_i-i로 변환해 B1<…<BN 조건을 비내림 제약으로 바꾸고, prefix 중앙값(힙 2번 push 1번 pop)으로 L1 오차 최소를 만든다. 역방향 최소 보정 후 B를 출력한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 13539번: 트리와 쿼리 11
Algorithm BOJ Data Structure Tree Dynamic Tree

[Algorithm] C++ 백준 13539번: 트리와 쿼리 11

루트가 있는 동적 포리스트에서 link/cut과 LCA 쿼리를 처리한다. Link-Cut Tree의 access로 간선 연결/분리와 LCA를 모두 O(log N) 분할상환으로 해결한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 14853번: 동전 던지기
Algorithm BOJ Probability Bayesian Math

[Algorithm] C++ 백준 14853번: 동전 던지기

관측된 앞면 횟수로 각 동전의 확률 p,q의 사후분포를 Beta로 만들고, P(p<q)를 Beta 함수 합으로 닫힌형태 계산한다. 로그 팩토리얼로 수치 안정성을 확보해 T=1e5도 처리한다.

12월 19, 2025
1 minute read
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
1 2 3 4 5 38
© 2018 - 2025 42JerryKim
Built with Hugo
Theme Stack designed by Jimmy