백준 1043 : 거짓말 c++
코드 #include #include using namespace std; int getParent(int parent[], int x){ if(parent[x] == x) return x; return parent[x] = getParent(parent, parent[x]); } void unionParent(int parent[], int a, int b){ a = getParent(parent, a); b = getParent(parent, b); if(a < b) parent[b] = a; else parent[a] = b; } bool findParent(int parent[], int a, int b){ a = getParent(parent, a); b = getParent(parent, b)..
백준 14500 : 테트로미노 c++
코드 #include #include using namespace std; int n, m; int map[501][501]; int temp; int answer; bool visited[501][501]; int dx[4] = {-1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1}; void dfs(int depth, int x, int y, int sum){ visited[x][y] = true; if(depth == 4){ if(sum > answer) answer = sum; return; } for(int i = 0; i = 0 && x+dx[i] = 0 && y+dy[i] < m){ if(visited[x..