/ 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++ 백준 25201번: 보드 뒤집기 게임
Algorithm BOJ Math Implementation

[Algorithm] C++ 백준 25201번: 보드 뒤집기 게임

2×2 블록 뒤집기는 각 행·열에서 색이 바뀌는 칸 수의 홀짝을 보존한다. 현재/목표 빨간 칸의 대칭차를 만들고 행·열별 등장 횟수가 모두 짝수인지 확인하면 O(N+M)으로 YES/NO를 판정한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 2586번: 소방차
Algorithm BOJ DP Greedy Sorting

[Algorithm] C++ 백준 2586번: 소방차

펌프/소방차 좌표를 정렬한 뒤 depth 버킷으로 분해하고, 각 버킷에서 인접 매칭과 1개 제외 DP로 최소 호스 길이 합을 O((P+F) log (P+F))에 계산한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 2988번: 아보가드로
Algorithm BOJ Graph Functional Graph

[Algorithm] C++ 백준 2988번: 아보가드로

3×N 표에서 열을 삭제한 뒤 각 행을 정렬했을 때 열별 값이 일치하도록 만든다. 첫 행이 순열임을 이용해 값→값 함수 두 개를 만들고, 두 함수의 순환(cycle)만 남기는 폐포를 BFS로 구해 삭제 최소를 계산한다.

12월 19, 2025
5 minute read
Featured image of post [Algorithm] C++ 백준 3006번: 터보소트
Algorithm BOJ Data Structure Fenwick Tree Prefix Sum

[Algorithm] C++ 백준 3006번: 터보소트

홀수 단계는 가장 작은 수를, 짝수 단계는 가장 큰 수를 인접 스왑으로 제자리로 보낸다. 각 단계의 스왑 횟수는 현재 위치 기준 남아있는 원소 수의 prefix/suffix 합이다. Fenwick Tree로 삭제와 합 쿼리를 O(log N)에 처리한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 32115번: 돌 놓기 게임
Algorithm BOJ Game-Theory Greedy Sorting

[Algorithm] C++ 백준 32115번: 돌 놓기 게임

원형 보드를 돌-돌 사이의 빈 구간으로 분해한다. 같은 색 끝 구간은 독점, 다른 색 끝 구간은 양쪽 절반을 가져가고 홀수 길이는 가운데 값만 남는다. 남은 가운데 값들을 내림차순 정렬해 번갈아 더해 O(N log N)으로 점수를 구한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 32190번: Ian Sequences
Algorithm BOJ Constructive Math

[Algorithm] C++ 백준 32190번: Ian Sequences

1..N이 각각 두 번 등장하는 길이 2N 수열을 구성한다. S_N=[N,N-1]+S_{N-2}+[N,N-1]로 감싸며 (N-1)^2≡1, N≡1(mod N-1)로 모듈 조건을 귀납적으로 증명한다. 홀짝 베이스(S1,S2)에서 시작해 덱으로 O(N)에 생성·출력한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 33543번: 둘이 한 팀
Algorithm BOJ Data Structure Sorting Binary Search Prefix Sum

[Algorithm] C++ 백준 33543번: 둘이 한 팀

A,B 전체에 동일 증가가 반복된다. d=A-B를 정렬하고 delta=addA-addB로 흡수해 Σmax(d+delta,0)을 upper_bound와 누적합으로 O((N+Q)logN)에 계산한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 3948번: 홍준이의 친위대
Algorithm BOJ Combinatorics DP

[Algorithm] C++ 백준 3948번: 홍준이의 친위대

양끝을 제외한 모든 위치가 지역 최솟값/최댓값이 되도록 하는 순열을 센다. 이는 up-down(교대) 순열과 동치이며 Entringer 수 DP로 N≤20에서 오일러 지그재그 수를 빠르게 구한다.

12월 19, 2025
3 minute read
Featured image of post [Algorithm] C++ 백준 5498번: Batch Scheduling
Algorithm BOJ DP Convex Hull Trick

[Algorithm] C++ 백준 5498번: Batch Scheduling

연속 작업을 배치로 나눌 때 총 비용(출력시간×가중치)을 최소화한다. DP 점화식을 정리해 일차함수 최소화 형태로 만들고, 단조 조건을 이용한 Convex Hull Trick으로 O(N)~O(N log N)에 해결한다.

12월 19, 2025
4 minute read
Featured image of post [Algorithm] C++ 백준 5813번: 이상적인 도시
Algorithm BOJ Graph Tree Grid Shortest Path

[Algorithm] C++ 백준 5813번: 이상적인 도시

격자 도시(구멍 없음)의 최단거리 합을 행/열 연속구간으로 압축해 두 가중 트리로 분해한다. 각 트리에서 간선 절단 시 양쪽 가중치 곱을 합산해 O(N log N)으로 1e9 모듈 답을 구한다.

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