Skip to content

Commit 0fafc6b

Browse files
committed
[Gold III] Title: 마법사 상어와 토네이도, Time: 508 ms, Memory: 39972 KB -BaekjoonHub
1 parent 494207b commit 0fafc6b

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

백준/Gold/20057. 마법사 상어와 토네이도/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
### 성능 요약
66

7-
메모리: 38816 KB, 시간: 560 ms
7+
메모리: 39972 KB, 시간: 508 ms
88

99
### 분류
1010

1111
구현, 시뮬레이션
1212

1313
### 제출 일자
1414

15-
2025년 11월 23일 19:43:43
15+
2025년 11월 26일 13:00:37
1616

1717
### 문제 설명
1818

백준/Gold/20057. 마법사 상어와 토네이도/마법사 상어와 토네이도.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,8 @@ class Main {
99
static int[] percent = { 1, 1, 2, 2, 5, 7, 7, 10, 10 };
1010

1111
// 왼쪽, 아래쪽, 오른쪽, 위쪽
12-
static int[][] tDy = {
13-
{ -1, 1, -2, 2, 0, -1, 1, -1, 1, 0 },
14-
{ -1, -1, 0, 0, 2, 0, 0, 1, 1, 1 },
15-
{ -1, 1, -2, 2, 0, -1, 1, -1, 1, 0},
16-
{ 1, 1, 0, 0, -2, 0, 0,-1, -1, -1}
17-
};
18-
static int[][] tDx = {
19-
{ 1, 1, 0, 0, -2, 0, 0, -1, -1, -1 },
20-
{ -1, 1, -2, 2, 0, -1, 1, -1, 1, 0},
21-
{ -1, -1, 0, 0, 2, 0, 0, 1, 1, 1},
22-
{ -1, 1, -2, 2, 0, -1, 1, -1, 1, 0}
23-
};
12+
static int[][] tDy;
13+
static int[][] tDx;
2414

2515
static int[] Dy = { 0, 1, 0, -1 };
2616
static int[] Dx = { -1, 0, 1, 0 };
@@ -40,6 +30,17 @@ public static void main(String[] args) throws Exception {
4030
B[i][j] = Integer.parseInt(st.nextToken());
4131
}
4232

33+
tDy = new int[4][10];
34+
tDx = new int[4][10];
35+
tDy[0] = new int[] {-1, 1, -2, 2, 0, -1, 1, -1, 1, 0};
36+
tDx[0] = new int[] { 1, 1, 0, 0, -2, 0, 0, -1, -1, -1 };
37+
for(int i=1;i<4;i++) {
38+
for(int j=0;j<10;j++) {
39+
tDy[i][j] = -tDx[i-1][j];
40+
tDx[i][j] = tDy[i-1][j];
41+
}
42+
}
43+
4344
ans = 0;
4445

4546
int size = 0;

0 commit comments

Comments
 (0)