/ 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 English BOJ Graph Movie Math Design Pattern Geometry CSharp

Tags

Documentation Implementation 문서화 구현 Best-Practices Code-Quality Testing 테스트 코드품질 Optimization 최적화 Debugging Tutorial 디버깅 Performance Education Guide Refactoring Clean-Code 교육

Archives

2026 167
2025 421
2024 177
2023 24
2022 79
More
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
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
1 15 16 17 18 19 20 21 22 23 92
© 2018 - 2026 42JerryKim
Built with Hugo
Theme Stack designed by Jimmy