일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 페이코 추천인코드
- 최단 경로
- 페이코 초대코드
- php 프로그래밍 입문 예제
- 플러터
- 플러터 개발환경 설정
- php 프로그래밍 입문 3판
- 배열
- C언어
- php 프로그래밍
- 자바
- 백준
- Java
- php 프로그래밍 입문 솔루션
- 스프링
- php 프로그래밍 입문 문제풀이
- Flutter
- php 프로그래밍 입문 연습문제
- 자바 스프링
- 페이코 친구코드
- 페이코 추천인
- 한정 분기
- 파이썬
- C
- JAVA SPRING
- php 프로그래밍 입문
- programmers
- php
- spring
- SWEA
- Today
- Total
ImJay
[BOJ/Java] 17144. 미세먼지 안녕! 본문
[BOJ/Java] 17144. 미세먼지 안녕!
해설
풀이
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static int r;
static int c;
static int startX1, startY1, startX2, startY2;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
// 입력 받기
String input = br.readLine();
StringTokenizer st = new StringTokenizer(input);
r = Integer.parseInt(st.nextToken()); // 격자판의 행 수
c = Integer.parseInt(st.nextToken()); // 격자판의 열 수
int t = Integer.parseInt(st.nextToken()); // 시간
// 격자판 상태 입력 받기
int[][] graph = new int[r][c]; // 미세먼지 양을 저장할 배열
int[][] after = new int[r][c]; // 시간에 따른 미세먼지 양 변화를 저장할 배열
boolean status = false; // 공기청정기 위치 확인을 위한 플래그
for (int x = 0; x < r; x++) {
input = br.readLine();
st = new StringTokenizer(input);
for (int y = 0; y < c; y++) {
graph[x][y] = Integer.parseInt(st.nextToken());
after[x][y] = graph[x][y];
if (!status && graph[x][y] == -1) { // 공기청정기 위치 확인
startX1 = x;
startY1 = y;
startX2 = x + 1;
startY2 = y;
status = true;
}
}
}
// 확산 및 정화 작업 반복
int[][] direction = {{0, -1}, {0, 1}, {1, 0}, {-1, 0}}; // 상하좌우 방향
for (int i = 0; i < t; i++) {
// 확산 작업
for (int x = 0; x < r; x++) {
for (int y = 0; y < c; y++) {
int a = graph[x][y] / 5; // 확산되는 미세먼지 양
int count = 0; // 확산된 방향의 개수
for (int j = 0; j < 4; j++) {
int newX = x + direction[j][0];
int newY = y + direction[j][1];
if (checkStatus(newX, newY)) { // 유효한 위치인지 확인
after[newX][newY] += a;
count++;
}
}
after[x][y] -= a * count; // 남은 미세먼지 양 업데이트
}
}
// deep copy
for (int x = 0; x < r; x++) {
for (int y = 0; y < c; y++) {
graph[x][y] = after[x][y];
}
}
// 위쪽 정화
after[startX1][1] = 0;
for (int y = startY1 + 1; y < c - 1; y++) {
after[startX1][y + 1] = graph[startX1][y];
}
for (int x = startX1; x > 0; x--) {
after[x - 1][c - 1] = graph[x][c - 1];
}
for (int y = c - 1; y > 0; y--) {
after[0][y - 1] = graph[0][y];
}
for (int x = 0; x < startX1 - 1; x++) {
after[x + 1][0] = graph[x][0];
}
// 아래쪽 정화
after[startX2][1] = 0;
for (int y = startY2 + 1; y < c - 1; y++) {
after[startX2][y + 1] = graph[startX2][y];
}
for (int x = startX2; x < r - 1; x++) {
after[x + 1][c - 1] = graph[x][c - 1];
}
for (int y = c - 1; y > 0; y--) {
after[r - 1][y - 1] = graph[r - 1][y];
}
for (int x = r - 1; x > startX2 + 1; x--) {
after[x - 1][0] = graph[x][0];
}
// deep copy
for (int x = 0; x < r; x++) {
for (int y = 0; y < c; y++) {
graph[x][y] = after[x][y];
}
}
}
// 미세먼지 양 총합 계산
int ans = 0;
for (int x = 0; x < r; x++) {
for (int y = 0; y < c; y++) {
ans += after[x][y];
}
}
sb.append(ans + 2); // 공기청정기 칸의 -1 값 2개를 더해줌
// 결과 출력
System.out.println(sb);
}
// 유효한 위치인지 확인하는 함수
public static boolean checkStatus(int x, int y) {
return 0 <= x && x < r && 0 <= y && y < c && !((x == startX1 || x == startX2) && (y == startY1));
}
}
테스트 케이스 보기 ↓ 더보기 클릭
7 8 50
0 0 0 0 0 0 0 9
0 0 0 0 3 0 0 8
-1 0 5 0 0 0 22 0
-1 8 0 0 0 0 0 0
0 0 0 0 0 10 43 0
0 0 5 0 15 0 0 0
0 0 40 0 0 0 20 0
---확산 1초 후---
0 0 0 0 0 0 1 8
0 0 1 0 3 0 5 6
-1 2 1 1 0 4 6 5
-1 5 2 0 0 2 12 0
0 1 1 0 5 10 13 8
0 1 9 4 3 5 12 0
0 8 17 8 3 4 8 4
---정화 1초 후---
0 0 0 0 0 1 8 6
0 0 1 0 3 0 5 5
-1 0 2 1 1 0 4 6
-1 0 5 2 0 0 2 12
0 1 1 0 5 10 13 0
0 1 9 4 3 5 12 8
8 17 8 3 4 8 4 0
---확산 2초 후---
0 0 0 0 0 2 7 6
0 0 1 0 3 1 3 5
-1 0 3 1 1 0 6 6
-1 1 1 3 1 2 6 7
0 1 3 1 3 6 9 5
1 5 6 5 5 6 8 7
9 10 9 4 5 6 7 1
---정화 2초 후---
0 0 0 0 2 7 6 5
0 0 1 0 3 1 3 6
-1 0 0 3 1 1 0 6
-1 0 1 1 3 1 2 6
1 1 3 1 3 6 9 7
9 5 6 5 5 6 8 5
10 9 4 5 6 7 1 7
---확산 3초 후---
0 0 0 0 3 5 5 5
0 0 1 0 3 2 5 5
-1 0 0 3 1 1 1 5
-1 0 1 1 3 2 4 5
2 2 4 2 5 4 8 7
9 4 4 4 4 6 7 5
8 9 7 4 6 6 4 6
---정화 3초 후---
0 0 0 3 5 5 5 5
0 0 1 0 3 2 5 5
-1 0 0 0 3 1 1 1
-1 0 0 1 1 3 2 4
9 2 4 2 5 4 8 5
8 4 4 4 4 6 7 7
9 7 4 6 6 4 6 5
---확산 4초 후---
0 0 0 4 3 4 5 5
0 0 1 0 4 4 3 4
-1 0 0 0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5 5 2 3 3
---정화 12초 후---
4 2 2 3 2 0 1 0
3 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 0 4 0 0
5 2 5 3 2 4 3 4
5 6 4 3 5 4 3 2
4 3 5 5 2 3 3 0
---확산 13초 후---
4 2 2 3 2 0 1 0
3 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 2 0 0 4 0 0
4 5 1 4 3 4 3 4
4 3 7 5 1 5 3 2
5 5 3 3 4 3 3 0
---정화 13초 후---
2 2 3 2 0 1 0 0
4 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 2 0 0 4 0
4 5 1 4 3 4 3 0
5 3 7 5 1 5 3 4
5 3 3 4 3 3 0 2
---확산 14초 후---
2 2 3 2 0 1 0 0
4 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 1 0 2 0 0 4 0
6 1 3 5 3 5 3 0
3 6 4 2 3 1 4 4
4 4 4 5 3 4 0 2
---정화 14초 후---
2 3 2 0 1 0 0 0
2 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 2 0 0 4
3 1 3 5 3 5 3 0
4 6 4 2 3 1 4 0
4 4 5 3 4 0 2 4
---확산 15초 후---
2 3 2 0 1 0 0 0
2 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 1 2 1 0 4
3 2 4 1 5 1 4 0
5 2 6 3 3 2 4 0
4 6 2 4 4 0 2 4
---정화 15초 후---
3 2 0 1 0 0 0 0
2 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 1 2 1 0
5 2 4 1 5 1 4 4
4 2 6 3 3 2 4 0
6 2 4 4 0 2 4 0
---확산 16초 후---
3 2 0 1 0 0 0 0
2 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 2 2 1 0
3 3 5 2 1 2 4 4
6 3 2 4 4 2 4 0
4 3 5 4 0 2 4 0
---정화 16초 후---
2 0 1 0 0 0 0 0
3 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 1 2 2 1
6 3 5 2 1 2 4 0
4 3 2 4 4 2 4 4
3 5 4 0 2 4 0 0
---확산 17초 후---
2 0 1 0 0 0 0 0
3 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 1 2 2 1
4 5 1 3 1 2 4 0
5 4 3 4 4 2 4 4
4 2 5 0 2 4 0 0
---정화 17초 후---
0 1 0 0 0 0 0 0
2 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 0 1 2 2
5 5 1 3 1 2 4 1
4 4 3 4 4 2 4 0
2 5 0 2 4 0 0 4
---확산 18초 후---
0 1 0 0 0 0 0 0
2 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 1 0 1 0 1 2 2
4 2 2 3 1 2 4 1
5 6 3 4 4 2 4 0
3 2 1 2 4 0 0 4
---정화 18초 후---
1 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 1 0 1 2
5 2 2 3 1 2 4 2
3 6 3 4 4 2 4 1
2 1 2 4 0 0 4 0
---확산 19초 후---
1 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 1 0 1 2
3 4 2 3 1 2 4 2
5 2 4 4 4 2 4 1
2 2 2 4 0 0 4 0
---정화 19초 후---
0 0 0 0 0 0 0 0
1 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 0 1 0 1
5 4 2 3 1 2 4 2
2 2 4 4 4 2 4 2
2 2 4 0 0 4 0 1
---확산 20초 후---
0 0 0 0 0 0 0 0
1 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 0 1 0 1
3 5 2 3 1 2 4 2
3 2 4 4 4 2 4 2
2 2 4 0 0 4 0 1
---정화 20초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 1 0 1 0
3 5 2 3 1 2 4 1
2 2 4 4 4 2 4 2
2 4 0 0 4 0 1 2
---확산 21초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 1 0 0 1 0 1 0
4 1 3 3 1 2 4 1
2 3 4 4 4 2 4 2
2 4 0 0 4 0 1 2
---정화 21초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 0 1 0 1
2 1 3 3 1 2 4 0
2 3 4 4 4 2 4 1
4 0 0 4 0 1 2 2
---확산 22초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 1 0 0 1 0 1
2 1 3 3 1 2 4 0
2 3 4 4 4 2 4 1
4 0 0 4 0 1 2 2
---정화 22초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 0 0 1 0
2 1 3 3 1 2 4 1
4 3 4 4 4 2 4 0
0 0 4 0 1 2 2 1
---확산 23초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 1 0 0 1 0
2 1 3 3 1 2 4 1
4 3 4 4 4 2 4 0
0 0 4 0 1 2 2 1
---정화 23초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 1 0 0 1
4 1 3 3 1 2 4 0
0 3 4 4 4 2 4 1
0 4 0 1 2 2 1 0
---확산 24초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 1 0 0 1
4 1 3 3 1 2 4 0
0 3 4 4 4 2 4 1
0 4 0 1 2 2 1 0
---정화 24초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 1 0 0
0 1 3 3 1 2 4 1
0 3 4 4 4 2 4 0
4 0 1 2 2 1 0 1
---확산 25초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 1 0 0
0 1 3 3 1 2 4 1
0 3 4 4 4 2 4 0
4 0 1 2 2 1 0 1
---정화 25초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 1 0
0 1 3 3 1 2 4 0
4 3 4 4 4 2 4 1
0 1 2 2 1 0 1 0
---확산 26초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 1 0
0 1 3 3 1 2 4 0
4 3 4 4 4 2 4 1
0 1 2 2 1 0 1 0
---정화 26초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 1
4 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 2 2 1 0 1 0 1
---확산 27초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 1
4 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 2 2 1 0 1 0 1
---정화 27초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 1
1 3 4 4 4 2 4 0
2 2 1 0 1 0 1 0
---확산 28초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 1
1 3 4 4 4 2 4 0
2 2 1 0 1 0 1 0
---정화 28초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
2 3 4 4 4 2 4 1
2 1 0 1 0 1 0 0
---확산 29초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
2 3 4 4 4 2 4 1
2 1 0 1 0 1 0 0
---정화 29초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
2 1 3 3 1 2 4 0
2 3 4 4 4 2 4 0
1 0 1 0 1 0 0 1
---확산 30초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
2 1 3 3 1 2 4 0
2 3 4 4 4 2 4 0
1 0 1 0 1 0 0 1
---정화 30초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
2 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 1 0 1 0 0 1 0
---확산 31초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
2 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 1 0 1 0 0 1 0
---정화 31초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 0 1 0 0 1 0 0
---확산 32초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 0 1 0 0 1 0 0
---정화 32초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 1 0 0 1 0 0 0
---확산 33초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 1 0 0 1 0 0 0
---정화 33초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 0 0 1 0 0 0 0
---확산 34초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 0 0 1 0 0 0 0
---정화 34초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 0 1 0 0 0 0 0
---확산 35초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 0 1 0 0 0 0 0
---정화 35초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 1 0 0 0 0 0 0
---확산 36초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 1 0 0 0 0 0 0
---정화 36초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 0 0 0 0 0 0 0
---확산 37초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
1 0 0 0 0 0 0 0
---정화 37초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 38초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
1 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 38초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 39초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
1 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 39초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 40초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 40초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 41초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 41초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 42초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 42초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 43초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 43초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 44초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 44초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 45초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 45초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 46초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 46초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 47초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 47초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 48초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 48초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 49초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 49초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---확산 50초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
---정화 50초 후---
0 0 0 0 0 0 0 0
0 0 2 2 2 3 2 0
-1 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 1 3 3 1 2 4 0
0 3 4 4 4 2 4 0
0 0 0 0 0 0 0 0
46
종료 코드 0(으)로 완료된 프로세스
'알고리즘 > 구현' 카테고리의 다른 글
[BOJ/Java] 1244. 스위치 켜고 끄기 (1) | 2024.01.29 |
---|---|
[BOJ/Java] 21610. 마법사 상어와 비바라기 (0) | 2024.01.29 |
[BOJ/Java] 3985. 롤 케이크 (0) | 2024.01.29 |
[BOJ/Java] 2999. 비밀 이메일 (2) | 2024.01.24 |
[BOJ/Java] 13300. 방 배정 (1) | 2024.01.23 |