알고리즘초보
-
[BOJ] 21608 상어 초등학교 / C++공부/PS (백준) 2021. 10. 8. 02:36
#include #include #include using namespace std; int N; struct st { int num; int friends[4]; }; struct st students[20 * 20 + 10]; int seats[20 + 10][20 + 10]; // (1, 1) ~ (N, N) int dx[4] = { -1,1,0,0 }; int dy[4] = { 0,0,-1,1 }; int cur_x, cur_y; struct cand { int x, y; int cnt_empty; int cnt_friends; }; vector candidates; bool cmp(cand &vec1, cand &vec2) { if (vec1.cnt_friends > vec2.cnt_friend..