[BOJ]14502번: 연구소 (c++)
https://www.acmicpc.net/problem/14502 14502번: 연구소 인체에 치명적인 바이러스를 연구하던 연구소에서 바이러스가 유출되었다. 다행히 바이러스는 아직 퍼지지 않았고, 바이러스의 확산을 막기 위해서 연구소에 벽을 세우려고 한다. 연구소는 크� www.acmicpc.net #include #include #include #include using namespace std; template using double_v = vector; struct pos { int x, y; }; int N, M; const int NEW_WALL = 3; enum {LAND, WALL, VIRUS}; int dr_x[] = { 0, 1, 0, -1 }; int dr_y[] = { 1, 0, -..
2020. 6. 13.
[BOJ]16948번: 데스 나이트 (c++)
https://www.acmicpc.net/problem/16948 16948번: 데스 나이트 게임을 좋아하는 큐브러버는 체스에서 사용할 새로운 말 "데스 나이트"를 만들었다. 데스 나이트가 있는 곳이 (r, c)라면, (r-2, c-1), (r-2, c+1), (r, c-2), (r, c+2), (r+2, c-1), (r+2, c+1)로 이동할 수 있다. 크 www.acmicpc.net bfs #include #include #include #include using namespace std; int dr_x[] = {-2, -2, 0, 0, 2, 2}; int dr_y[] = {-1, 1, -2, 2, -1, 1}; struct pos { int x, y; }; int bfs(vector &board..
2020. 6. 13.