-
Notifications
You must be signed in to change notification settings - Fork 1
28-g0rnn #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9kyo-hwang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄ν΄ λλ²κΉ μ μκ°μ μμ² μΌλ€μ γ γ ...
- ν μ¬μ΄ν΄λ§λ€ μ¬μ©λλ μ μ λ°©λ¬Έ μ²΄ν¬ λ°°μ΄κ³Ό νΉμ λΈλ‘ κ·Έλ£Ήμμ μ¬μ©λλ μ§μ λ°©λ¬Έ μ²΄ν¬ λ°°μ΄μ λ³λλ‘ λ¬μΌ νλ κ²
- λΈλ‘ κ·Έλ£Ήμ ν¬κΈ° λΉκ΅λ₯Ό μλͺ»ν κ²(...)
μ΄ 2κ°μ§ λλ¬Έμ κ²°κ³Όκ° μ΄μ§ μκΎΈκ° λμ μ°Έ κ³ μ λ§μ΄ νμ΅λλ€ νν...
λΈλ‘ κ·Έλ£Ήμ λν΄ λ€κ³ μμ΄μΌ ν μ λ³΄κ° λ§μμ, μ λ ꡬ쑰체λ₯Ό νλ μ μνμ΅λλ€. κΈ°μ€ λΈλ‘ μ’ν, μΌλ° λΈλ‘ κ°μ, 무μ§κ° λΈλ‘ κ°μ, κ·Έλ£Ήμ μνλ λΈλ‘λ€μ λ€κ³ μλλ‘ νμ΅λλ€. λν λΈλ‘ ν¬κΈ°λ₯Ό λΉκ΅νλ μ°μ°μλ₯Ό μ μνμ΅λλ€. μ΄ κ΅¬μ‘°μ²΄ λμ ν΄λΉ λΈλ‘ κ·Έλ£Ήμ μ§μ°λ μμ μ μ½κ² κ°λ₯νμ£ :)
μΌμ±μ΄ μ’μνλ μ€λ ₯ μμ©κ³Ό νμ ... μ΄μ κ·Έλ§ μ’μν λκ° λμ§ μμλ μΆλ€μ γ γ γ
#include <bits/stdc++.h>
using namespace std;
using Vector2 = pair<int, int>;
constexpr int BLACK = -1;
constexpr int RAINBOW = 0;
constexpr int REMOVED = -2;
constexpr int MAX_N = 20;
int N, M;
int grid[MAX_N][MAX_N];
bool gVisited[MAX_N][MAX_N];
bool lVisited[MAX_N][MAX_N];
const vector<Vector2> OFFSET {
{-1, 0},
{0, 1},
{1, 0},
{0, -1}
};
inline bool isOutOfBound(int r, int c) {
return r < 0 || r >= N || c < 0 || c >= N;
}
struct Group {
Vector2 base{};
int numNormal = 0, numRainbow = 0;
vector<Vector2> blocks{};
friend bool operator<(const Group& a, const Group& b) {
if (a.blocks.size() != b.blocks.size()) {
return a.blocks.size() < b.blocks.size();
} else if (a.numRainbow != b.numRainbow) {
return a.numRainbow < b.numRainbow;
} else {
return a.base < b.base;
}
}
};
Group bfs(int i, int j, int color) {
memset(lVisited, 0, sizeof(lVisited));
queue<Vector2> q;
Group retval;
{
retval.base = {i, j};
retval.numNormal = 1;
retval.numRainbow = 0;
}
lVisited[i][j] = true;
q.emplace(i, j);
retval.blocks.emplace_back(i, j);
while (!q.empty()) {
const auto [r, c] = q.front(); q.pop();
for(const auto& [dr, dc] : OFFSET) {
int nr = r + dr, nc = c + dc;
if (isOutOfBound(nr, nc) || lVisited[nr][nc]) {
continue;
}
int v = grid[nr][nc];
if (v != color && v != RAINBOW) {
continue;
}
lVisited[nr][nc] = true;
q.emplace(nr, nc);
v == RAINBOW ? retval.numRainbow++ : retval.numNormal++;
retval.blocks.emplace_back(nr,nc);
}
}
return retval;
}
bool findBiggest(Group& best) {
memset(gVisited, 0, sizeof(gVisited));
bool found = false;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
const int color = grid[i][j];
if (color <= RAINBOW || gVisited[i][j]) {
continue;
}
Group retval = bfs(i, j, color);
if (retval.blocks.size() < 2) {
continue;
}
for (const auto& [r, c] : retval.blocks) {
if (grid[r][c] > RAINBOW)
gVisited[r][c] = true;
}
if (!found || best < retval) {
found = true;
best = retval;
}
}
}
return found;
}
int removeGroup(const Group& g) {
for (const auto& [r, c] : g.blocks) {
grid[r][c] = REMOVED;
}
int sz = g.blocks.size();
return sz * sz;
}
void applyGravity() {
for (int c = 0; c < N; ++c) {
int write = N - 1;
for (int r = N - 1; r >= 0; --r) {
if (grid[r][c] == BLACK) {
write = r - 1;
} else if (grid[r][c] != REMOVED) {
if (write != r) {
grid[write][c] = grid[r][c];
grid[r][c] = REMOVED;
}
--write;
}
}
}
}
void rotateCCW() {
int tmp[MAX_N][MAX_N];
for (int r = 0; r < N; ++r) {
for (int c = 0; c < N; ++c) {
tmp[N - 1 - c][r] = grid[r][c];
}
}
memcpy(grid, tmp, sizeof(grid));
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> M;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
cin >> grid[i][j];
}
}
int score = 0;
Group best;
while (true) {
if (!findBiggest(best)) {
break;
}
score += removeGroup(best);
applyGravity();
rotateCCW();
applyGravity();
}
cout << score;
return 0;
}
kangrae-jo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ λ ν 2μκ° ~ 2μκ° 30λΆ μ λ κ±Έλ¦° κ² κ°μμ.
μ λ κ°μ₯ν° κ·Έλ£Ήμ μ ννλ κ³Όμ μμ λΉκ΅ λ‘μ§μ μ‘°κΈ λ§μ μκ°μ μ΄ κ² κ°μμ.
μ΄μ λ λ°λ‘μκ³ ... μ κ° λ¬Έμ λ₯Ό μλͺ»μ½μμμ΅λλ€..
κ·Έλλκ³ νμ κ³Ό μ€λ ₯ λ©μλλ₯Ό λ§ λ§μ‘λ€μ.
κ·Έλ¦¬κ³ μ νμ λ©μλλ₯Ό 보면 νΉμ΄ν μλ μλλ°μ.
μ κ° μ§μ μκ°ν΄λ΄μ΄ μ‘°κΈ λΏλ―ν©λλ€.
λ€λ₯Έ λΆλ€λ μκ°ν΄λ΄μ
¨κ² μ§λ§ κ°μΈμ μΈ μ±μ·¨κ°...
(μμ μ λΉμ·ν λ¬Έμ κ° μμλ κ² κ°κΈ°λ νλ€μ. μΉ΄μΉ΄μ€ μ΄μ λ리기 λ¬Έμ μλ)
μ΄μ¨λ κ· νΈλ λ§μ²λΌ νΉλ³ν μ΄λ €μ΄ λΆλΆμ μμμ§λ§ μκ°μ μμ£Όμμ£Ό μ€λκ±Έλ¦° κ·Έλ° λ¬Έμ λ€μ...
μ’μλ¬Έμ κ°μ¬ν©λλ€.
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int EMPTY = -2;
const int BLACK = -1;
const int RAINBOW = 0;
const int OFFSET[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
struct Group {
int y = -1, x = -1;
int normal = -1;
int rainbow = -1;
bool operator<(const Group& other) const {
int b1 = normal + rainbow, b2 = other.normal + other.rainbow;
if (b1 != b2) return b1 < b2;
if (rainbow != other.rainbow) return rainbow < other.rainbow;
if (normal != other.normal) return normal < other.normal;
if (y != other.y) return y < other.y;
return x < other.x;
}
};
bool isIn(int y, int x, int N) { return 0 <= y && y < N && 0 <= x && x < N; }
Group getGroupSize(vector<vector<int>>& board, int y, int x, int color, int N, vector<vector<bool>>& v) {
vector<vector<bool>> visited(N, vector<bool>(N, false));
queue<pair<int, int>> q;
q.push({y, x});
visited[y][x] = true;
Group group = {y, x, 0, 0};
while (!q.empty()) {
auto [curY, curX] = q.front();
q.pop();
if (board[curY][curX] == RAINBOW) group.rainbow++;
else {
v[curY][curX] = true;
group.normal++;
}
for (int dir = 0; dir < 4; dir++) {
int nextY = curY + OFFSET[dir][0];
int nextX = curX + OFFSET[dir][1];
if (isIn(nextY, nextX, N) && !visited[nextY][nextX] &&
(board[nextY][nextX] == color ||
board[nextY][nextX] == RAINBOW)) {
q.push({nextY, nextX});
visited[nextY][nextX] = true;
}
}
}
return group;
}
void eraseBlock(vector<vector<int>>& board, int y, int x, int color, int N) {
vector<vector<bool>> visited(N, vector<bool>(N, false));
queue<pair<int, int>> q;
q.push({y, x});
visited[y][x] = true;
while (!q.empty()) {
auto [curY, curX] = q.front();
q.pop();
board[curY][curX] = EMPTY;
for (int dir = 0; dir < 4; dir++) {
int nextY = curY + OFFSET[dir][0];
int nextX = curX + OFFSET[dir][1];
if (isIn(nextY, nextX, N) && !visited[nextY][nextX] &&
(board[nextY][nextX] == color ||
board[nextY][nextX] == RAINBOW)) {
q.push({nextY, nextX});
visited[nextY][nextX] = true;
}
}
}
}
void moveDown(vector<vector<int>>& board, int N) {
for (int x = 0; x < N; x++) {
for (int y = N - 2; y >= 0; y--) {
if (board[y][x] != EMPTY && board[y][x] != BLACK) {
int offset = 1;
while (y + offset < N) {
if (board[y + offset][x] == EMPTY) offset++;
else break;
}
if (y + offset - 1 != y) {
board[y + offset - 1][x] = board[y][x];
board[y][x] = EMPTY;
}
}
}
}
}
vector<vector<int>> rotate(vector<vector<int>>& board, int N) {
vector<vector<int>> rotated(N, vector<int>(N, EMPTY));
for (int y = 0; y < N; y++) {
for (int x = 0; x < N; x++) {
rotated[abs(x - N + 1)][y] = board[y][x];
}
}
return rotated;
}
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> board(N, vector<int>(N));
for (int y = 0; y < N; y++) {
for (int x = 0; x < N; x++) {
cin >> board[y][x];
}
}
int score = 0;
while (true) {
vector<vector<bool>> visited(N, vector<bool>(N, false));
Group largest;
for (int y = 0; y < N; y++) {
for (int x = 0; x < N; x++) {
if (!visited[y][x] && board[y][x] != BLACK &&
board[y][x] != EMPTY && board[y][x] != RAINBOW) {
Group temp = getGroupSize(board, y, x, board[y][x], N, visited);
if (largest < temp) largest = temp;
}
}
}
if (largest.normal == 0 || largest.normal + largest.rainbow < 2) break;
score += (largest.normal + largest.rainbow) * (largest.normal + largest.rainbow);
eraseBlock(board, largest.y, largest.x, board[largest.y][largest.x], N);
moveDown(board, N);
board = rotate(board, N);
moveDown(board, N);
}
cout << score;
return 0;
}| private static void pull() { | ||
| for (int j = 0; j < n; j++) { | ||
| for (int i = n - 2; i >= 0; i--) { | ||
| if (board[i][j] < 0) continue; | ||
|
|
||
| int ny = i; | ||
| while (ny + 1 < n && board[ny + 1][j] == EMPTY) { | ||
| if (board[ny][j] == -1) break; // κ²μ λΈλ‘μ μ΄λνμ§ μμ | ||
| board[ny + 1][j] = board[ny][j]; | ||
| board[ny][j] = EMPTY; | ||
| ny++; | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λΉ
ν λ₯΄ e λ©μλκ° μ§κ΄μ μ΄κ³ κΉλνλ€μ.
μ λ μ΄μ§ μ΄ν΄νκΈ°λ μ½μ§λ§ μ§μ λΆν μ½λκ° λ κ² κ°κΈ°λ ν΄μ.
μ₯λ³΄κ³ κ°λλ€.
wnsmir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ν... λ€μνμ΄λ νμκ° μ’ λ걸리λ€μ
κ³ μνμ
¨μ΅λλ€
from collections import deque
def bfs(grid):
N = len(grid)
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
visited = [[-1]*N for _ in range(N)]
max_blocks = []
max_rainbow = 0
for x in range(N):
for y in range(N):
color = None
blocks = []
rainbow = 0
# μμ μΉΈμ΄ μΌλ° λΈλ‘μ΄ μλλ©΄ 건λλ°κΈ°
if grid[x][y] <= 0:
continue
else:
queue = deque()
queue.append((x, y))
blocks.append((x, y))
visited[x][y] = 1
color = grid[x][y]
while queue:
cx, cy = queue.popleft()
for i in range(4):
nx, ny = cx + dx[i], cy + dy[i]
if 0 <= nx < N and 0 <= ny < N and visited[nx][ny] == -1:
# 무μ§κ° λΈλ‘
if grid[nx][ny] == 0:
queue.append((nx, ny))
blocks.append((nx, ny))
rainbow += 1
visited[nx][ny] = 2
# μΌλ° λΈλ‘μ΄λ©΄μ μμ΄ κ°μ κ²½μ°
elif grid[nx][ny] != -1 and color is not None and grid[nx][ny] == color:
queue.append((nx, ny))
visited[nx][ny] = 1
blocks.append((nx, ny))
# 무μ§κ° λΈλ‘λ§ λ€μ λ―Έλ°©λ¬ΈμΌλ‘
for i in range(N):
for j in range(N):
if visited[i][j] == 2:
visited[i][j] = -1
# κ·Έλ£Ή μ΅μ 쑰건 κ²μ¬
if color is None or len(blocks) < 2:
continue
# κ·Έλ£Ή μ°μ μμ λΉκ΅: ν¬κΈ° β 무μ§κ° μ β κΈ°μ€ λΈλ‘
if len(max_blocks) < len(blocks):
max_blocks = blocks[:]
max_rainbow = rainbow
elif len(max_blocks) == len(blocks):
if rainbow > max_rainbow:
max_blocks = blocks[:]
max_rainbow = rainbow
elif rainbow == max_rainbow:
max_std = (N, N)
for bx, by in max_blocks:
if grid[bx][by] > 0:
if (bx < max_std[0]) or (bx == max_std[0] and by < max_std[1]):
max_std = (bx, by)
cur_std = (N, N)
for bx, by in blocks:
if grid[bx][by] > 0:
if (bx < cur_std[0]) or (bx == cur_std[0] and by < cur_std[1]):
cur_std = (bx, by)
if (cur_std[0] > max_std[0]) or (cur_std[0] == max_std[0] and cur_std[1] > max_std[1]):
max_blocks = blocks[:]
max_rainbow = rainbow
# κ°λ₯ν κ·Έλ£Ήμ λ€ μ°Ύμ λ€
if not max_blocks:
return False
score = len(max_blocks) * len(max_blocks)
for bx, by in max_blocks:
grid[bx][by] = -2
return score
def gravity(grid):
N = len(grid)
for x in range(N-2, -1, -1):
for y in range(N):
if grid[x][y] < 0:
continue
nx = x
while nx + 1 < N and grid[nx + 1][y] == -2:
grid[nx+1][y], grid[nx][y] = grid[nx][y], -2
nx += 1
def rotate(grid):
N = len(grid)
new_grid = [[0]*N for _ in range(N)]
for i in range(N):
for j in range(N):
new_grid[N-j-1][i] = grid[i][j]
for i in range(N):
for j in range(N):
grid[i][j] = new_grid[i][j]
N, M = map(int, input().split())
grid = [list(map(int, input().split())) for _ in range(N)]
total_score = 0
while True:
score = bfs(grid)
if score is False:
print(total_score)
break
total_score += score
gravity(grid)
rotate(grid)
gravity(grid)
kokeunho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ κ²½μ¨μΌν μ‘°κ±΄μ΄ λ§κΈ°λ νκ³ λ°νν΄μΌ ν κ°λ λ§μμ
λ§μ΄ ν·κ°λ¦° λ¬Έμ μμ΅λλ€.
μ¬μ€ μλ μ½λλ‘ μ μΆνμ λ,
1νλ‘ λͺ»μ±μ°κ³ μ€λ΅μ΄ λ΄λλ° λμ ν ν΄κ²°λͺ»νκ² μ΄μ ν¬κΈ°ν©λλ€;
μμ μ
μΆλ ₯μ λ§κ² λμ€λλ° λκ° λ¬Έμ μΌκΉμ
code
import java.util.*;
public class Main {
static int N, M;
static int[][] map;
static boolean[][] visited;
static final int EMPTY = -2;
static int[] dx = {-1, 1, 0, 0};
static int[] dy = {0, 0, -1, 1};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
M = sc.nextInt();
map = new int[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
map[i][j] = sc.nextInt();
}
}
int score = 0;
while (true) {
BlockGroup group = findBiggestGroup();
if (group == null || group.blocks.size() < 2) break;
for (int[] pos : group.blocks) map[pos[0]][pos[1]] = EMPTY;
score += group.blocks.size() * group.blocks.size();
gravity();
rotate();;
gravity();
}
System.out.println(score);
}
static class BlockGroup implements Comparable<BlockGroup> {
List<int[]> blocks;
int rainbowCount;
int standardRow, standardCol;
public BlockGroup(List<int[]> blocks, int rainbowCount, int standardRow, int standardCol) {
this.blocks = blocks;
this.rainbowCount = rainbowCount;
this.standardRow = standardRow;
this.standardCol = standardCol;
}
@Override
public int compareTo(BlockGroup o) {
if (this.blocks.size() != o.blocks.size()) return o.blocks.size() - this.blocks.size();
if (this.rainbowCount != o.rainbowCount) return o.rainbowCount - this.rainbowCount;
if (this.standardRow != o.standardRow) return o.standardRow - this.standardRow;
return o.standardCol - this.standardCol;
}
}
static BlockGroup findBiggestGroup() {
visited = new boolean[N][N];
BlockGroup biggest = null;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (map[i][j] <= 0 || visited[i][j]) continue;
BlockGroup group = bfs(i, j, map[i][j]);
if (group.blocks.size() >= 2) {
if (biggest == null || group.compareTo(biggest) < 0) {
biggest = group;
}
}
}
}
return biggest;
}
static BlockGroup bfs(int x, int y, int color) {
Queue<int[]> queue = new LinkedList<>();
List<int[]> blocks = new ArrayList<>();
boolean[][] tempVisited = new boolean[N][N];
int rainbowCount = 0;
queue.add(new int[]{x, y});
blocks.add(new int[]{x, y});
visited[x][y] = true;
tempVisited[x][y] = true;
while (!queue.isEmpty()) {
int[] current = queue.poll();;
for (int i = 0; i < 4; i++) {
int nx = current[0] + dx[i];
int ny = current[1] + dy[i];
if (nx >= 0 && nx < N && ny >= 0 && ny < N && !tempVisited[nx][ny]
&& (map[nx][ny] == color || map[nx][ny] == 0)) {
queue.add(new int[]{nx, ny});
blocks.add(new int[]{nx, ny});
tempVisited[nx][ny] = true;
if (map[nx][ny] != 0) visited[nx][ny] = true;
if (map[nx][ny] == 0) rainbowCount++;
}
}
}
int standardRow = -1, standardCol = -1;
for (int[] pos : blocks) {
int i = pos[0], j = pos[1];
if (map[i][j] == 0) {
visited[i][j] = false;
continue;
}
if (standardRow < i || (standardRow == i && standardCol < j)) {
standardRow = i;
standardCol = j;
}
}
return new BlockGroup(blocks, rainbowCount, standardRow, standardCol);
}
static void gravity() {
for (int j = 0; j < N; j++) {
for (int i = N - 2; i >= 0; i--) {
if (map[i][j] < 0) continue;
int r = i;
while (r + 1 < N && map[r+1][j] == EMPTY) {
if (map[r][j] == -1) break;
map[r+1][j] = map[r][j];
map[r][j] = EMPTY;
r++;
}
}
}
}
static void rotate() {
int[][] newMap = new int[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
newMap[N-1-j][i] = map[i][j];
}
}
map = newMap;
}
}
κ·ΌνΈλ κ³ μνμ ¨μ΅λλ€. λ©μλ λΆλ¦¬κ° μ λμ΄μμ΄μ μ½κΈ° μ¬μ μ΄μ. λ¬Έμ κ° κ΅¬νν΄μΌν μ¬μν μ‘°κ±΄μ΄ λ§μμ μ λ΅μ λμΆνλλ° λ μ΄λ €μμ‘λ€κ³ μκ°ν©λλ€. μ κ° μ°Ύμ λͺκ°μ§ μμ μ¬νμ λ¨Όμ μλ €λ리μλ©΄
newMap[j][N - 1 - i] = map[i][j];μ κ°μ΄ μμ ν΄μΌν©λλ€.
if (standardRow == -1 || i < standardRow || (i == standardRow && j < standardCol)) {
standardRow = i;
standardCol = j;
}μ΄κ±° μμ νλ©΄ ν μ€νΈ μΌμ΄μ€λΆν° μ€ν¨νκΈ΄ν©λλ€.. μλ§ ν μΌ ν΅κ³Όλ건 μ°μ°μ΄ μλκΉ νλ μ‘°μ¬μ€λ¬μ΄ μκ°.. |
π λ¬Έμ λ§ν¬
μμ΄ μ€νκ΅
βοΈ μμλ μκ°
2h 30m
β¨ μλ μ½λ
μμ΄ μ‘λλ° μκ°μ μ€λ μ»λ€μ.. λ©μλλ₯Ό ꡬννλκ² μ λ§ μ΄λ €μ μ΅λλ€. μ¬μν λΆλΆμμ μΊμΉν΄μΌν κ² λ§λκ΅°μ.
ꡬνμ λ©μλ 4κ°λ§ μμ±νλ©΄ λ©λλ€.
bfs
λ¨Όμ κ°μ₯ μ΄λ €μ΄ λΈλ‘ κ·Έλ£Ήμ μμ±νλ λ©μλμ λλ€. μ²μμ λΈλ‘ κ·Έλ£Ήμ sizeλ§ λ°ννλ©΄ λ κ±°λΌ μκ°νλλ° λΈλ‘ κ·Έλ£Ήμ μ°μ μμκ°
μ΄λ―λ‘ μμ±ν λΈλ‘ κ·Έλ£Ήμ λν΄ 4κ°μ§ μ λ³΄κ° νμν΄μ λ°°μ΄μ ννλ‘ λ°νν©λλ€.
무μ§κ° λΈλ‘μ μ€λ³΅ λ°©λ¬Έμ΄ κ°λ₯νκΈ° λλ¬Έμ visited λ°°μ΄μ λκ° μ¨μΌν©λλ€.
visitedλ λΈλ‘ κ·Έλ£Ήμ νμνλλ° μ¬μ©λκ³ ,globalVisitedλ 무μ§κ° λΈλ‘μ μ μΈν λΈλ‘ κ·Έλ£Ή μμ± νν©μ λλ€.κΈ°μ€ λΈλ‘μ μ°ΎκΈ° μν΄
blocksλ₯Ό μννλ©° ν λ²νΈκ° κ°μ₯ μμΌλ©΄μ μ΄λ²νΈκ° κ°μ₯ μμ λ μμ μ°Ύμ΅λλ€.boardλ₯Ό νμ μν€λ λ©μλλ μ¬μ°λ λμ΄κ°κ³ , μ€λ ₯μ₯μ μν λ°©ν₯λ§ μ μνλ©΄ λ κ±° κ°μ΅λλ€.
μ κ³ λ³΄λ μ΄λ €μ΄ λΆλΆμ ν¬κ² μλκ±° κ°μ΅λλ€.. κ·Όλ° μλ§ μ¬μν μ€μλ₯Ό νκ² λλ€λ©΄ μκ°μ 무μ§λ§μ§νκ² μ¨λ²λ¦΄ λ¬Έμ λ λ¬Έμ μμ½κ³ μΉ¨μ°©νκ² νΈμκΈΈ λ°λΌκ² μ΅λλ€! λ¬Όλ‘ μ μ§νκ³Ό ν¨κ» νμ΅λλ€ :) κ·Έλλ μ€λ κ±Έλ ·λ€μ
π μλ‘κ² μκ²λ λ΄μ©