로딩
요청 처리 중입니다...

토마토 2

 토마토 2

문제 설명 솔루션 토마토 1번과 같은 풀이로 풀었다. 다른 점은 문제 자체가 3차원을 기준으로 하다 보니 탐색에 필요한 배열도 3차원 배열로 하여 간단하게 풀었다. 3차원 배열을 평소에 쓸 일 자체가 거의 없다 보니 입력받을 때, 살짝 뇌 정지가 온 것 말곤 어려운 건 없었다.

#include #include #include using namespace std; struct info { int y; int x; int f; //floor int day; }; struct cell { int state; bool visit; }; int m, n, h; int dir[6][3] = { {1, 0, 0}, {0, 1, 0}, {-1, 0, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0,-1} }; vector > box; queue q; int BFS() { int currD...

원문 링크 : 토마토 2