Approach 2178번과 다를바가 없음. 다만, 이동하는 양상이 총 8개인점만 다르다. Code #include #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; typedef pair pii; int r[300][300]; bool visited[300][300]; int move_x[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; int move_y[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int main(void){ fastio; int t; cin >> t; while(t--){ memset(r, 0, sizeof(r)); memset(visited..
[백준 7562번] [BFS] 나이트의 이동
Approach 2178번과 다를바가 없음. 다만, 이동하는 양상이 총 8개인점만 다르다. Code #include #define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) using namespace std; typedef pair pii; int r[300][300]; bool visited[300][300]; int move_x[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; int move_y[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int main(void){ fastio; int t; cin >> t; while(t--){ memset(r, 0, sizeof(r)); memset(visited..
2021.12.13