From 3a64756971f5dee2ddb97b662697d049e3dbf639 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Mon, 22 Jul 2024 01:37:21 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[BOJ]=20#18352.=20=ED=8A=B9=EC=A0=95=20?= =?UTF-8?q?=EA=B1=B0=EB=A6=AC=EC=9D=98=20=EB=8F=84=EC=8B=9C=20=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20/=20=EC=8B=A4=EB=B2=842=20/=2070=EB=B6=84=20/=20?= =?UTF-8?q?=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...04\354\213\234\354\260\276\352\270\260.py" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "minjeong/DFSBFS/2024-07-22-[\353\260\261\354\244\200]-#18352-\355\212\271\354\240\225\352\261\260\353\246\254\354\235\230\353\217\204\354\213\234\354\260\276\352\270\260.py" diff --git "a/minjeong/DFSBFS/2024-07-22-[\353\260\261\354\244\200]-#18352-\355\212\271\354\240\225\352\261\260\353\246\254\354\235\230\353\217\204\354\213\234\354\260\276\352\270\260.py" "b/minjeong/DFSBFS/2024-07-22-[\353\260\261\354\244\200]-#18352-\355\212\271\354\240\225\352\261\260\353\246\254\354\235\230\353\217\204\354\213\234\354\260\276\352\270\260.py" new file mode 100644 index 00000000..93f03e7d --- /dev/null +++ "b/minjeong/DFSBFS/2024-07-22-[\353\260\261\354\244\200]-#18352-\355\212\271\354\240\225\352\261\260\353\246\254\354\235\230\353\217\204\354\213\234\354\260\276\352\270\260.py" @@ -0,0 +1,40 @@ +import sys +from collections import deque + +input = sys.stdin.readline + +def bfs(start): + global k + queue = deque([start]) + visited[start] = 0 # 시작 노드의 거리를 0으로 설정 + while queue: + node = queue.popleft() + for connected_node in graph[node]: # 해당 노드와 연결된 노드 순회 + if visited[connected_node] == -1: # 방문하지 않은 노드일 경우 + queue.append(connected_node) # 큐에 추가하고 + visited[connected_node] = visited[node] + 1 # 거리를 1 증가 + + # 연결된 노드의 거리가 k와 같다면 answer 리스트에 추가 + if visited[connected_node] == k: + answer.append(connected_node) + return answer + +# 도시 개수 n, 도로 개수 m, 거리 정보 k, 출발도시 번호 x +n, m, k, x = map(int, input().strip().split()) +visited = [-1 for _ in range(n + 1)] # 모든 노드를 -1로 초기화 (방문하지 않은 상태) +graph = [[] for _ in range(n + 1)] +answer = [] + +# 그래프 연결 +for _ in range(m): + u, v = map(int, input().strip().split()) + graph[u].append(v) + +# BFS 호출 -> 출발도시 번호 x로 시작 +answer = bfs(x) +if not answer: + print(-1) +else: + answer.sort() + for u in answer: + print(u) \ No newline at end of file From c5280e1d82e3e300bc9004d0528b559c468ec9a5 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Fri, 26 Jul 2024 02:15:18 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[BOJ]=20#13305.=20=EC=A3=BC=EC=9C=A0?= =?UTF-8?q?=EC=86=8C=20/=20=EC=8B=A4=EB=B2=843=20/=2050=EB=B6=84=20/=20?= =?UTF-8?q?=ED=9E=8C=ED=8A=B8->=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...05-\354\243\274\354\234\240\354\206\214.py" | 18 ++++++++++++++++++ ...05-\354\243\274\354\234\240\354\206\214.py" | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 "minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" create mode 100644 "minjeong/Greedy/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" diff --git "a/minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" "b/minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" new file mode 100644 index 00000000..7c2b8ae6 --- /dev/null +++ "b/minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" @@ -0,0 +1,18 @@ +import sys +input = sys.stdin.readline + +# 초기화 +n = int(input()) # n: 도시의 개수 +road = list(map(int, input().split())) # 도로의 길이 +oil_price = list(map(int, input().split())) # 리터당 가격 + +min_cost = 0 # 최저 비용 +min_price = oil_price[0] # 첫번째 도시의 기름 가격 + +for i in range(n - 1): + if oil_price[i] < min_price: # 현재 도시에서의 기름 가격이 최소 가격보다 작으면 갱신 + min_price = oil_price[i] + min_cost += min_price * road[i] # 현재 도시에서 다음 도시로 이동할 때 드는 비용을 추가 + +print(min_cost) + diff --git "a/minjeong/Greedy/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" "b/minjeong/Greedy/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" new file mode 100644 index 00000000..7c2b8ae6 --- /dev/null +++ "b/minjeong/Greedy/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" @@ -0,0 +1,18 @@ +import sys +input = sys.stdin.readline + +# 초기화 +n = int(input()) # n: 도시의 개수 +road = list(map(int, input().split())) # 도로의 길이 +oil_price = list(map(int, input().split())) # 리터당 가격 + +min_cost = 0 # 최저 비용 +min_price = oil_price[0] # 첫번째 도시의 기름 가격 + +for i in range(n - 1): + if oil_price[i] < min_price: # 현재 도시에서의 기름 가격이 최소 가격보다 작으면 갱신 + min_price = oil_price[i] + min_cost += min_price * road[i] # 현재 도시에서 다음 도시로 이동할 때 드는 비용을 추가 + +print(min_cost) + From ba593ee4eafd4566d760423ce3a0b27209cf3166 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Fri, 26 Jul 2024 18:21:06 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[BOJ]=20#9184.=20=EC=8B=A0=EB=82=98?= =?UTF-8?q?=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=8B=A4=ED=96=89=20/=20?= =?UTF-8?q?=EC=8B=A4=EB=B2=842=20/=2060=EB=B6=84=20/=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...5-\354\243\274\354\234\240\354\206\214.py" | 18 --------------- ...50\354\210\230\354\213\244\355\226\211.py" | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) delete mode 100644 "minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" create mode 100644 "minjeong/DynamicProgramming/2024-07-26-[\353\260\261\354\244\200]-#9184-\354\213\240\353\202\230\353\212\224\355\225\250\354\210\230\354\213\244\355\226\211.py" diff --git "a/minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" "b/minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" deleted file mode 100644 index 7c2b8ae6..00000000 --- "a/minjeong/DFSBFS/2024-07-26-[\353\260\261\354\244\200]-#13305-\354\243\274\354\234\240\354\206\214.py" +++ /dev/null @@ -1,18 +0,0 @@ -import sys -input = sys.stdin.readline - -# 초기화 -n = int(input()) # n: 도시의 개수 -road = list(map(int, input().split())) # 도로의 길이 -oil_price = list(map(int, input().split())) # 리터당 가격 - -min_cost = 0 # 최저 비용 -min_price = oil_price[0] # 첫번째 도시의 기름 가격 - -for i in range(n - 1): - if oil_price[i] < min_price: # 현재 도시에서의 기름 가격이 최소 가격보다 작으면 갱신 - min_price = oil_price[i] - min_cost += min_price * road[i] # 현재 도시에서 다음 도시로 이동할 때 드는 비용을 추가 - -print(min_cost) - diff --git "a/minjeong/DynamicProgramming/2024-07-26-[\353\260\261\354\244\200]-#9184-\354\213\240\353\202\230\353\212\224\355\225\250\354\210\230\354\213\244\355\226\211.py" "b/minjeong/DynamicProgramming/2024-07-26-[\353\260\261\354\244\200]-#9184-\354\213\240\353\202\230\353\212\224\355\225\250\354\210\230\354\213\244\355\226\211.py" new file mode 100644 index 00000000..02e46b01 --- /dev/null +++ "b/minjeong/DynamicProgramming/2024-07-26-[\353\260\261\354\244\200]-#9184-\354\213\240\353\202\230\353\212\224\355\225\250\354\210\230\354\213\244\355\226\211.py" @@ -0,0 +1,23 @@ +import sys +input = sys.stdin.readline + +def w(a, b, c): + if (a, b, c) in memo: + return memo[(a, b, c)] + if a <= 0 or b <= 0 or c <= 0: + memo[(a, b, c)] = 1 + return 1 + elif a > 20 or b > 20 or c > 20: + memo[(a, b, c)] = w(20, 20, 20) + elif a < b and b < c: + memo[(a, b, c)] = w(a, b, c - 1) + w(a, b - 1, c - 1) - w(a, b - 1, c) + else: + memo[(a, b, c)] = w(a - 1, b, c) + w(a - 1, b - 1, c) + w(a - 1, b, c - 1) - w(a - 1, b - 1, c - 1) + return memo[(a, b, c)] + +memo = {} +while True: + a, b, c = map(int, input().split()) + if a == -1 and b == -1 and c == -1: + break + print('w(%d, %d, %d) = %d' % (a, b, c, w(a, b, c))) \ No newline at end of file From 35025db2f247fa5f84562bf82b2c5b43ce8cb646 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Sat, 27 Jul 2024 16:03:02 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[BOJ]=20#14940.=20=EC=89=AC=EC=9A=B4=20?= =?UTF-8?q?=EC=B5=9C=EB=8B=A8=EA=B1=B0=EB=A6=AC=20/=20=EC=8B=A4=EB=B2=841?= =?UTF-8?q?=20/=2033=EB=B6=84=20/=20=EC=8B=A4=ED=8C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...34\353\213\250\352\261\260\353\246\254.py" | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 "minjeong/DFSBFS/2024-07-27-[\353\260\261\354\244\200]-#14940-\354\211\254\354\232\264\354\265\234\353\213\250\352\261\260\353\246\254.py" diff --git "a/minjeong/DFSBFS/2024-07-27-[\353\260\261\354\244\200]-#14940-\354\211\254\354\232\264\354\265\234\353\213\250\352\261\260\353\246\254.py" "b/minjeong/DFSBFS/2024-07-27-[\353\260\261\354\244\200]-#14940-\354\211\254\354\232\264\354\265\234\353\213\250\352\261\260\353\246\254.py" new file mode 100644 index 00000000..9672e0c5 --- /dev/null +++ "b/minjeong/DFSBFS/2024-07-27-[\353\260\261\354\244\200]-#14940-\354\211\254\354\232\264\354\265\234\353\213\250\352\261\260\353\246\254.py" @@ -0,0 +1,47 @@ +import sys +from collections import deque +input = sys.stdin.readline + +# 목표지점까지의 거리 구하기 +def find_distance_to_goal(n, m, grid): + # 거리배열(모든 지점에 대한 거리를 저장) + distances = [[-1 for _ in range(m)] for _ in range(n)] + + # 목표지점 찾기 + for i in range(n): + for j in range(m): + if grid[i][j] == 2: # 목표지점의 위치 저장하고, 0으로 설정 + target_x = i + target_y = j + distances[i][j] = 0 + if grid[i][j] == 0: # 땅이 아닌 곳이므로 0으로 설정 + distances[i][j] = 0 + + queue = deque([(target_x, target_y)]) # 큐 초기화 + directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] # 방향 리스트 + + # BFS 탐색 + while queue: + x, y = queue.popleft() # 현재지점 pop + for dx, dy in directions: + nx, ny = x + dx, y + dy # 현재 지점에서 상하좌우 인접한 지점 + # 인접한 지점이 지도의 범위 안에 있고, 갈 수 있는 땅(값이 1)이며, 아직 방문하지 않은 지점이라면: + if (0 <= nx < n and 0 <= ny < m) and grid[nx][ny] == 1 and distances[nx][ny] == -1: + distances[nx][ny] = distances[x][y] + 1 # 인접한 지점의 거리를 현재 지점의 거리 + 1로 설정 + queue.append((nx, ny)) # 인접한 지점을 큐에 추가 + + return distances + +# 초기화 +n, m = map(int, input().split()) # n: 세로, m: 가로 +grid = [] # 지도 +for _ in range(n): + line = list(map(int, input().split())) + grid.append(line) + +# 함수 호출 +distances = find_distance_to_goal(n, m, grid) + +# 정답 출력 +for d in distances: + print(" ".join(map(str, d))) # 공백을 구분하여 출력 From 0b43921692c4c091562642b8d2a7aebfb68785cb Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Sat, 27 Jul 2024 16:44:39 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[BOJ]=20#30802.=20=EC=9B=B0=EC=BB=B4?= =?UTF-8?q?=ED=82=A4=ED=8A=B8=20/=20=EB=B8=8C=EB=A1=A0=EC=A6=883=20/=2022?= =?UTF-8?q?=EB=B6=84=20/=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\260\354\273\264\355\202\244\355\212\270.py" | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 "minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#30802-\354\233\260\354\273\264\355\202\244\355\212\270.py" diff --git "a/minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#30802-\354\233\260\354\273\264\355\202\244\355\212\270.py" "b/minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#30802-\354\233\260\354\273\264\355\202\244\355\212\270.py" new file mode 100644 index 00000000..c05e2508 --- /dev/null +++ "b/minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#30802-\354\233\260\354\273\264\355\202\244\355\212\270.py" @@ -0,0 +1,16 @@ +import sys +from math import ceil +input = sys.stdin.readline + +n = int(input()) # 참가자 수 +sizes = list(map(int, input().split())) # 티셔츠사이즈별 신청자 수(S, M, L, XL, XXL, XXXL) +t, p = map(int, input().split()) # t: 티셔츠 묶음 수, p: 펜 묶음 수 + +# t장씩 최소 몇 묶음 주문해야 하는지 계산 +min_t_shirts = 0 +for s in sizes: + min_t_shirts += ceil(s / t) +print(min_t_shirts) + +# p자루씩 최대 몇 묶음 주문할 수 있는지와, 그 때 펜을 한 자루씩 몇 개 주문하는지 계산 +print(n // p, n % p) From cb44434340d3bfe91f6f811ccb43545bc390e995 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Sat, 27 Jul 2024 17:12:50 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[BOJ]=20#28702.=20FizzBuzz=20/=20=EB=B8=8C?= =?UTF-8?q?=EB=A1=A0=EC=A6=881=20/=2020=EB=B6=84=20/=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\260\261\354\244\200]-#28702-FizzBuzz.py" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "minjeong/String/2024-07-27-[\353\260\261\354\244\200]-#28702-FizzBuzz.py" diff --git "a/minjeong/String/2024-07-27-[\353\260\261\354\244\200]-#28702-FizzBuzz.py" "b/minjeong/String/2024-07-27-[\353\260\261\354\244\200]-#28702-FizzBuzz.py" new file mode 100644 index 00000000..9d0218bc --- /dev/null +++ "b/minjeong/String/2024-07-27-[\353\260\261\354\244\200]-#28702-FizzBuzz.py" @@ -0,0 +1,25 @@ +import sys +from math import ceil +input = sys.stdin.readline + +# FizzBuzz 문자열 배열 +fizzbuzz = [0] * 3 +for i in range(3): + fizzbuzz[i] = input().strip() + +for s in fizzbuzz: + if s.isdigit(): # 문자열이 숫자로 이루어져있다면, + idx = fizzbuzz.index(s) # 해당 문자열의 위치를 저장하여 + answer = int(fizzbuzz[idx]) + (3 - idx) # 정답 값을 구하기 + +# FizzBuzz 규칙에 따라 정답 출력 +if answer % 3 == 0 and answer % 5 == 0: + print("FizzBuzz") +elif answer % 3 == 0: + print("Fizz") +elif answer % 5 == 0: + print("Buzz") +else: + print(answer) + + From 6f50dae9885e0d8660a74ef411e2456b57f4534a Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Sat, 27 Jul 2024 17:23:33 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[BOJ]=20#31403.=20A+B-C=20/=20=EB=B8=8C?= =?UTF-8?q?=EB=A1=A0=EC=A6=884=20/=202=EB=B6=84=20/=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4-07-27-[\353\260\261\354\244\200]-#31403-A+B-C.py" | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 "minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#31403-A+B-C.py" diff --git "a/minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#31403-A+B-C.py" "b/minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#31403-A+B-C.py" new file mode 100644 index 00000000..4b182fda --- /dev/null +++ "b/minjeong/Math/2024-07-27-[\353\260\261\354\244\200]-#31403-A+B-C.py" @@ -0,0 +1,10 @@ +import sys +from math import ceil +input = sys.stdin.readline + +a = int(input()) +b = int(input()) +c = int(input()) + +print(a + b - c) +print(int(str(a)+str(b))-c) \ No newline at end of file From 2723e4db7f4abf3b8e7b2549593dcad7f861b2a0 Mon Sep 17 00:00:00 2001 From: Mingguriguri Date: Mon, 29 Jul 2024 20:13:18 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[BOJ]=20#18405.=20=EA=B2=BD=EC=9F=81?= =?UTF-8?q?=EC=A0=81=20=EC=A0=84=EC=97=BC=20/=20=EA=B3=A8=EB=93=9C5=20/=20?= =?UTF-8?q?48=EB=B6=84=20/=20=EC=8B=A4=ED=8C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 6148 -> 6148 bytes ...01\354\240\201\354\240\204\354\227\274.py" | 43 ++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 "minjeong/DFSBFS/2024-07-29-[\353\260\261\354\244\200]-#18405-\352\262\275\354\237\201\354\240\201\354\240\204\354\227\274.py" diff --git a/.DS_Store b/.DS_Store index d1f8cd31c7971779173f47e8c90be8ec29558a6a..a47ba5a1f7355ab6ebc6f805a582c60628016948 100644 GIT binary patch delta 151 zcmZoMXffEJ$`Z$-me0Vzz`~%%kj{|FP?DSP;*yk;p9B=+aFE~6RIGK(5mi0~uY5s< zVQ_MOZUIma0|Wnu&CM*;OiW*-Cb27UM63JU*r$BVaT2@OWIJ{)HVA*RAG`uCu{caj LoU)mn<1aq|oQN!0 diff --git "a/minjeong/DFSBFS/2024-07-29-[\353\260\261\354\244\200]-#18405-\352\262\275\354\237\201\354\240\201\354\240\204\354\227\274.py" "b/minjeong/DFSBFS/2024-07-29-[\353\260\261\354\244\200]-#18405-\352\262\275\354\237\201\354\240\201\354\240\204\354\227\274.py" new file mode 100644 index 00000000..7cc2149c --- /dev/null +++ "b/minjeong/DFSBFS/2024-07-29-[\353\260\261\354\244\200]-#18405-\352\262\275\354\237\201\354\240\201\354\240\204\354\227\274.py" @@ -0,0 +1,43 @@ +import sys +from collections import deque +input = sys.stdin.readline + +def get_result(goal_sec, goal_x, goal_y, grid, n, k): + virus_info = [] # 바이러스 정보를 담는 리스트 초기화 + + # 시험관을 순회하며 바이러스 팀섹 + for i in range(n): + for j in range(n): + if grid[i][j] != 0: # 바이러스라면 + virus_info.append((grid[i][j], 0, i, j)) # 바이러스 번호, 현재 시간, x좌표, y좌표를 추가 + + virus_info.sort() # 바이러스 정보 리스트를 오름차순으로 정렬 + queue = deque(virus_info) # 큐 초기화 + directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] # 방향 리스트 (상, 하, 좌, 우) + + while queue: + virus_num, time, x, y = queue.popleft() + + # 목표 시간에 도달하면 종료 + if time == goal_sec: + break + + for dx, dy in directions: + nx, ny = x + dx, y + dy # 현재 지점에서 상하좌우 인접한 지점 + # 시험관 범위 안에 있고 아직 바이러스가 없는 경우 현재의 바이러스를 전파 + if (0 <= nx < n and 0 <= ny < n) and grid[nx][ny] == 0: + grid[nx][ny] = virus_num + queue.append((virus_num, time + 1, nx, ny)) + + return grid[goal_x][goal_y] + +# 입력 처리 +n, k = map(int, input().split()) # n: 시험관 크기 / k: 바이러스 개수 +grid = [] # 시험관 정보 +for _ in range(n): + li = list(map(int, input().split())) + grid.append(li) +s, x, y = map(int, input().split()) # 시간, x좌표, y좌표 + +# 함수 호출 및 결과 출력 +print(get_result(s, x-1, y-1, grid, n, k))