일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- VR
- 그리디 알고리즘
- BFS
- 알고리즘
- 그래프
- 스택
- Team Fortress 2
- DFS
- 백트래킹
- 문자열
- 우선순위 큐
- 트리
- 구현
- 다이나믹 프로그래밍
- 자료구조
- 투 포인터
- 백준
- 유니티
- 시뮬레이션
- XR Interaction Toolkit
- 브루트포스
- Unreal Engine 5
- 누적 합
- 재귀
- 유니온 파인드
- 수학
- 다익스트라
- c++
- 정렬
- ue5
- Today
- Total
목록치즈 C++ (2)
1일1알

가장자리에는 치즈가 놓이지 않기 때문에 0,0에서 빈 공간을 bfs로 탐색하면서 바깥쪽 공기를 검사한 뒤 치즈가 바깥쪽 공기와 2개의 면 이상 닿아있다면 녹도록 했다. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using int64 = long long; int n, m; int dRow[4] = { -1,0,1,0 }; int dCol[4] = { 0,1,0,-1 }; vector board; vector visited; vector isOut; void..

주어진 입력의 가장자리에는 치즈가 없기 때문에 (0, 0)에는 치즈가 절대 없을 것이다. 치즈가 전부 녹을 때까지 (0, 0)에서 bfs를 시작하여 치즈를 녹이는 것을 반복하였다. bfs 도중에 치즈를 만나면 continue를 해서 바깥에 있는 치즈만 녹도록 하였다. #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int r, c; int cheese_size = 0; int last_size = 0; int cnt = 0; int dRow[4] = { -1,0,1,0 ..