From 454f8b07528fdb2f3b1338637e75dc08d44164c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Nov 2023 18:48:31 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[=EC=9D=B4=EB=B6=84=ED=83=90=EC=83=89]=2011?= =?UTF-8?q?=EC=9B=94=208=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../10815.cpp" | 56 ++++++++++++ .../14500.java" | 80 +++++++++++++++++ .../16401.cpp" | 62 ++++++++++++++ .../2343.cpp" | 85 +++++++++++++++++++ .../3079.cpp" | 55 ++++++++++++ 5 files changed, 338 insertions(+) create mode 100644 "10_\354\235\264\353\266\204\355\203\220\354\203\211/10815.cpp" create mode 100644 "10_\354\235\264\353\266\204\355\203\220\354\203\211/14500.java" create mode 100644 "10_\354\235\264\353\266\204\355\203\220\354\203\211/16401.cpp" create mode 100644 "10_\354\235\264\353\266\204\355\203\220\354\203\211/2343.cpp" create mode 100644 "10_\354\235\264\353\266\204\355\203\220\354\203\211/3079.cpp" diff --git "a/10_\354\235\264\353\266\204\355\203\220\354\203\211/10815.cpp" "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/10815.cpp" new file mode 100644 index 0000000..6e68d06 --- /dev/null +++ "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/10815.cpp" @@ -0,0 +1,56 @@ +#include +#include +#include + +using namespace std; + +int BinarySearch(int key, const vector &arr, int n) { + int left = 0; + int right = arr.size() - 1; + int mid ; + + while(left <= right) { + mid = (left+right)/2; + + if(arr[mid] == key) { + return 1; + } else if(arr[mid] < key) { //오른쪽으로 + left = mid + 1; + } else { //왼쪽으로 + right = mid -1; + } + } + + return 0; +} + +int main() +{ + + cin.tie(0); cout.tie(0); + ios_base::sync_with_stdio(NULL); + + int n,m,t; + vector arr; + cin >> n; + + while(n--) { + cin >> t ; + arr.push_back(t); + } + + + //이분탐색은 우선, 정렬 필수 !! + sort(arr.begin(), arr.end()); + + + cin >> m ; + + while(m--) { + + cin >> t; + cout << BinarySearch(t, arr, n) << ' '; + } + + return 0; +} \ No newline at end of file diff --git "a/10_\354\235\264\353\266\204\355\203\220\354\203\211/14500.java" "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/14500.java" new file mode 100644 index 0000000..ea4fc67 --- /dev/null +++ "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/14500.java" @@ -0,0 +1,80 @@ +import java.util.Scanner; + +public class Main { + static int N, M; + static int[][] board; + static int max_val; + static int[][] d = { {-1, 0}, {1, 0}, {0, -1}, {0, 1} }; + static boolean[][] visited; + static int answer = 0; + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + N = scanner.nextInt(); + M = scanner.nextInt(); + board = new int[N][M]; + + for (int i = 0; i < N; i++) { + for (int j = 0; j < M; j++) { + board[i][j] = scanner.nextInt(); + } + } + + max_val = findMaxValue(board); + + d = new int[][] { {-1, 0}, {1, 0}, {0, -1}, {0, 1} }; + visited = new boolean[N][M]; + + for (int i = 0; i < N; i++) { + for (int j = 0; j < M; j++) { + visited[i][j] = true; + dfs(i, j, 1, board[i][j]); + visited[i][j] = false; + } + } + + System.out.println(answer); + } + + static void dfs(int x, int y, int step, int total) { + if (total + max_val * (4 - step) <= answer) { + return; + } + + if (step == 4) { + answer = Math.max(answer, total); + return; + } + + for (int[] direction : d) { + int nx = x + direction[0]; + int ny = y + direction[1]; + + if (isValid(nx, ny) && !visited[nx][ny]) { + if (step == 2) { + visited[nx][ny] = true; + dfs(x, y, step + 1, total + board[nx][ny]); + visited[nx][ny] = false; + } + + visited[nx][ny] = true; + dfs(nx, ny, step + 1, total + board[nx][ny]); + visited[nx][ny] = false; + } + } + } + + static boolean isValid(int x, int y) { + return x >= 0 && x < N && y >= 0 && y < M; + } + + static int findMaxValue(int[][] arr) { + int max = Integer.MIN_VALUE; + for (int[] row : arr) { + for (int val : row) { + max = Math.max(max, val); + } + } + return max; + } +} diff --git "a/10_\354\235\264\353\266\204\355\203\220\354\203\211/16401.cpp" "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/16401.cpp" new file mode 100644 index 0000000..b48ddc1 --- /dev/null +++ "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/16401.cpp" @@ -0,0 +1,62 @@ +#include +#include +#include //max 함수 헤더파일 + + +using namespace std; + +//이분 탐색. 반복문으로 구현. +int binarySearch(int max_snack, const vector &snack_length, int m) { + int cnt = 0; //나눠줄 수 있는 총 과자의 수 + int res = 0; + + int left = 1; + int right = max_snack; + int mid=0; + + while(left <= right) { + cnt = 0; + mid = (left+right) / 2; + + for(int i=0; i= m) { + left = mid+1; //오른쪽 이동 (더 큰 과자 사이즈로) + res = mid ; + + + } + + //나눠줄 수 있는 과자가 조카 수보다 작으면, 현재 길이로는 잘라줄 수 없음. + else { + right = mid-1; //왼쪽 이동 (더 작은 과자 사이즈로 자르기) + } + + } + + return res; +} + +int main() +{ + int m, n, t; + vector snack_length; //과자 길이들 저장할 벡터 + + cin >> m >> n; + + int max_snack = 1; //과자의 최대 길이 저장할 변수 + + //과자 길이 입력받기 + while(n--) { + cin >> t ; + snack_length.push_back(t); + max_snack = max(t, max_snack); + } + + cout << binarySearch(max_snack, snack_length, m); + + return 0; +} \ No newline at end of file diff --git "a/10_\354\235\264\353\266\204\355\203\220\354\203\211/2343.cpp" "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/2343.cpp" new file mode 100644 index 0000000..f5be96b --- /dev/null +++ "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/2343.cpp" @@ -0,0 +1,85 @@ +#include +#include +#include //min 함수 헤더파일 + + +using namespace std; + +//블루레이 크기의 범위로 이분 탐색. 반복문으로 구현. +int binarySearch(int left, int right, const vector &lessons, int m) { + int cnt = 0; //현재 사용한 블루레이 개수 + int res = 0; + int sum = 0; //블루레이 하나에 들어간 강의들 총 길이합 + int mid=0; + + while(left <= right) { + cnt = 0; + sum=0; + mid = (left+right) /2; //현재 블루레이의 크기 + + + + //cnt 계산 + for(int i=0; imid) { //블루레이 하나가 현재 지정한 크기(mid)를 초과했으면, + cnt++; + sum=lessons[i]; //현재 강의부터 다음 블루레이에 담기 + } else if(sum==mid) { //블루레이 하나가 딱 맞게 찼으면, + cnt++; + sum=0; //다시 빈 블루레이에 채우기 시작 ! + } + + } + + if(sum>0) { + cnt++; //마지막 블루레이 포함! + } + + + + if(cnt <= m) { //사용 가능한 블루레이 수 이하로 사용함 + res = mid; //현재 크기 답안으로 저장 ! + + //여기서 블루레이 개수를 더 줄일 수 있을까? 그럴려면 각 블루레이에 강의를 덜 담아야함. 현재 블루레이 크기보다 줄여야해 ! + right = mid-1; + + } + + else { //사용 가능한 블루레이수보다 많이 사용함 + //각 블루레이에 강의를 더 담아야함. 현재 블루레이 크기보다 늘여야해 ! + left = mid+1; + } + + + } + + return res; +} + +int main() +{ + ios::sync_with_stdio(false); + cin.tie(NULL); cout.tie(NULL); + + int m, n, t; + vector lessons; //강의 길이 벡터 + + cin >> n >> m; + + int all_lessons = 0; //모든 레슨의 길이 총 합 + int max_lessons = 0; //가장 긴 레슨 길이 + + //강의 길이 입력받기 + while(n--) { + cin >> t ; + lessons.push_back(t); + all_lessons += t; + max_lessons = max(max_lessons, t); + } + + cout << binarySearch(max_lessons, all_lessons, lessons, m); + + return 0; +} \ No newline at end of file diff --git "a/10_\354\235\264\353\266\204\355\203\220\354\203\211/3079.cpp" "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/3079.cpp" new file mode 100644 index 0000000..f89f73d --- /dev/null +++ "b/10_\354\235\264\353\266\204\355\203\220\354\203\211/3079.cpp" @@ -0,0 +1,55 @@ +#include +#include +#include + +using namespace std; + +//이분 탐색 +unsigned long long binarySearch(const vector& t, unsigned long long m, unsigned long long left, unsigned long long right) { + unsigned long long res = 0; + unsigned long long mid = 0; + unsigned long long q = 0; + + while (left <= right) { + mid = (left + right) / 2; + q=0; + + for (int t : t) { + q += mid / t; + } + + if (q >= m) { //m명 다 심사함 + right = mid - 1; + res = mid; + } else { + left = mid + 1; + } + } + + return res; +} + +int main() { + + ios::sync_with_stdio(false); + cin.tie(NULL); cout.tie(NULL); + + unsigned long long n,m,temp; //자료형 주의! 아니면 시간 초과.. + + + vector t; + + //입력 + cin >> n >> m; + while(n--) { + cin >> temp; + t.push_back(temp); + } + + //이분탐색 전 정렬 필수 ! + sort(t.begin(), t.end()); + + cout << binarySearch(t, m, 0, t[0] * m); + + return 0; +} From 11b5532e1d19f28d734e62c429c9eb05742f4d4a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 Nov 2023 18:53:14 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[=ED=88=AC=ED=8F=AC=EC=9D=B8=ED=84=B0]=2011?= =?UTF-8?q?=EC=9B=94=2015=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../14503.cpp" | 166 ++++++++++++++++++ .../20922.cpp" | 68 +++++++ .../2531.cpp" | 107 +++++++++++ 3 files changed, 341 insertions(+) create mode 100644 "11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" create mode 100644 "11_\355\210\254\355\217\254\354\235\270\355\204\260/20922.cpp" create mode 100644 "11_\355\210\254\355\217\254\354\235\270\355\204\260/2531.cpp" diff --git "a/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" "b/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" new file mode 100644 index 0000000..44b3562 --- /dev/null +++ "b/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" @@ -0,0 +1,166 @@ +#include + +using namespace std; + +int n, m, r, c, d; +int room[51][51]; + +bool dirtyPlaceExsist() { + + int sum = 0; //청소된 방 카운트 + + if(room[r-1][c]!=0) { //청소되었으면, sum +1 + sum ++; + } + + if(room[r][c-1]!=0) { + sum ++; + } + + if(room[r+1][c]!=0) { + sum ++; + } + + if(room[r][c+1]!=0) { + sum ++; + } + + if(sum == 4) { + return false; // 주변이 모두 청소됨. 청소 안된 곳이 없어. + } else { + return true; + } +} + + + + +int cleanRobot() { + + int cnt=0; + int tag = 0; + + + while(true) { + + + // #1. 현재 칸이 청소되지 않은 경우, 청소하기 + if(room[r][c]==0) { + cnt++; + room[r][c]=2; //청소된 상태 + //printf("요기 청소해따 : %d, %d / %d\n", r,c,d); + } + + + // #2. 주변 4칸 청소 안된 곳 있으면, + if(dirtyPlaceExsist()) + { + tag = 0; // 전진 여부 표기할 태그값 초기화 + while(tag != 1) { + + // 1) 90도 회전 + d--; + if(d<0) d+=4; + //printf("돌아따 %d\n", d); + + + + // 2) 바라보는 방향의 앞쪽 칸이 청소안돼있으면 전진 ! + switch(d) { + case 0 : //북 + if(room[r-1][c]==0) { + r--; + tag = 1; + break; + } + case 1 : //동 + if(room[r][c+1]==0) { + c++; + tag = 1; + break; + } + case 2 : //남 + if(room[r+1][c]==0) { + r++; + tag = 1; + break; + } + case 3 : //서 + if(room[r][c-1]==0) { + c--; + tag = 1; + break; + } + + } + } + + + } + + + + // #2. 주변 4칸 청소 안된 곳 없으면, + + else + { + + // 후진 가능하면 후진. 벽이면 멈춤. + switch(d) { + case 0 : //북 + if(room[r+1][c]==1) { + return cnt; + } else { //벽 아니면 + r++; + break; + } + case 1 : //동 + if(room[r][c-1]==1) { + return cnt; + } else { //벽 아니면 + c--; + break; + } + case 2 : //남 + if(room[r-1][c]==1) { + return cnt; + } else { //벽 아니면 + r--; + break; + } + case 3 : //서 + if(room[r][c+1]==1) { + return cnt; + } else { //벽 아니면 + c++; + break; + } + } + + + } + + } + + + + + return cnt; + +} + +int main() +{ + + cin >> n >> m >> r >> c >> d; + + for(int i=0; i> room[i][j]; + } + } + + cout << cleanRobot(); + + return 0; +} \ No newline at end of file diff --git "a/11_\355\210\254\355\217\254\354\235\270\355\204\260/20922.cpp" "b/11_\355\210\254\355\217\254\354\235\270\355\204\260/20922.cpp" new file mode 100644 index 0000000..cb7e1ab --- /dev/null +++ "b/11_\355\210\254\355\217\254\354\235\270\355\204\260/20922.cpp" @@ -0,0 +1,68 @@ +#include +#include +#include + +using namespace std; + +int findLength(const vector &sequence, int * cnt, int k) { + + int lp=0; //시작 포인터 + int rp=0; //끝 포인터 + + int left = 0; + int right = 0; + + int cur_length=0; + int max_length=0; + int tag=0; + + while(rp> n >> k; + + vector sequence; //전체 수열 입력받을 벡터 + int cnt[200001]; //부분 수열 내 숫자들 갯수 카운팅할 배열 + + while(n--) { + cin >> t; + sequence.push_back(t); + } + + cout< +#include +#include + +using namespace std; + +int solution(const vector &dish, int *visited, int k, int c, int n) { + + //최대, 현재의 최대한 다양하게 먹은 생선의 가짓수 저장할 변수 + int max_cnt=0; + int cur_cnt=0; + + int lp=0; + int rp=0; + int left=0; + int right=0; + + int coupon = 0; // 쿠폰 적용 여부 표시 + + while ( rp-lp < k ) { //k개 이하로 먹었을 때, 초반 세팅. + + right = dish[rp]; + visited[right]++; + + if(visited[right] == 1) { //새로운 초밥이 추가되었다면, 가짓수 +1 + cur_cnt++; + } + + + if(rp-lp == k-1 ) { // k개의 초밥이 충족됐으면, 현재의 cnt 값을 max에 저장 + max_cnt = cur_cnt; + break; + } + + rp++; + + } + + + do { //딱 k개만큼 연속해서 다 먹었을 때, + + // 포인터 조정 전, 지난 lp값 제외 + left = dish[lp%n]; + visited[left]--; + if(visited[left] == 0) { //딱 하나뿐인 초밥이 빠졌다면, 가짓수 -1 + cur_cnt--; + } + + // 포인터 조정, lp부터 rp까지 새로운 k개의 초밥 + lp++; + rp++; + lp%=n; + rp%=n; + + // 회전 초밥이니깐, 원형큐의 개념 떠올리며 mod 연산해주기 + + + //rp 조정 + right = dish[rp%n]; + visited[right]++; + if(visited[right] == 1) { //새로운 초밥이 추가되었다면, 가짓수 +1 + cur_cnt++; + } + + //쿠폰 초밥 구간 내 미포함이면, 쿠폰 한 종류 더 추가 ! + if(visited[c]==0) { + cur_cnt++; + coupon=1; + } + + + + + max_cnt = max(cur_cnt, max_cnt); + + + if(coupon==1) { //쿠폰 적용 되어있으면, 초기화 ! + coupon=0; + cur_cnt--; + } + + } while( lp !=0 ); + + return max_cnt; + +} + +int main() +{ + ios::sync_with_stdio(false); + cin.tie(NULL); cout.tie(NULL); + + int n, d, k, c, t; + cin >> n >> d >> k >> c ; //접시 개수, 초밥 가짓수, 이벤트 연속 횟수, 쿠폰 초밥 + vector dish; //n개의 접시에 담긴 초밥들 저장 + int visited[d+1] = {0}; //초밥 중복 여부 체크 위한 배열 + + int x = n; + while(x--) { + cin >> t; + dish.push_back(t); + } + + cout << solution(dish, visited, k, c, n); + + return 0; +} \ No newline at end of file From 0efe79081a5670258eae59f290dc34677f2cbdd5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Nov 2023 16:08:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[=ED=88=AC=ED=8F=AC=EC=9D=B8=ED=84=B0]=2011?= =?UTF-8?q?=EC=9B=94=2016=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../14503.cpp" | 206 ++++++------------ 1 file changed, 63 insertions(+), 143 deletions(-) diff --git "a/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" "b/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" index 44b3562..13f7028 100644 --- "a/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" +++ "b/11_\355\210\254\355\217\254\354\235\270\355\204\260/14503.cpp" @@ -1,166 +1,86 @@ #include +#include using namespace std; -int n, m, r, c, d; -int room[51][51]; +const int CLEAN = 2; //청소한 상태는 2로 저장 +int cnt = 0; //청소한 칸 개수 -bool dirtyPlaceExsist() { - - int sum = 0; //청소된 방 카운트 - - if(room[r-1][c]!=0) { //청소되었으면, sum +1 - sum ++; - } - - if(room[r][c-1]!=0) { - sum ++; - } - - if(room[r+1][c]!=0) { - sum ++; - } - - if(room[r][c+1]!=0) { - sum ++; - } - - if(sum == 4) { - return false; // 주변이 모두 청소됨. 청소 안된 곳이 없어. - } else { - return true; - } -} +//현재 칸 기준 4가지 방향: { 북, 동, 남, 서 } +int dx[4] = { 0, 1, 0, -1 }; +int dy[4] = { -1, 0, 1, 0 }; +int clean(int n, int m, int r, int c, int d, vector>& board) { + int cnt = 0; //청소한 칸 개수 초기화 - - -int cleanRobot() { - - int cnt=0; - int tag = 0; - - - while(true) { - - - // #1. 현재 칸이 청소되지 않은 경우, 청소하기 - if(room[r][c]==0) { - cnt++; - room[r][c]=2; //청소된 상태 - //printf("요기 청소해따 : %d, %d / %d\n", r,c,d); + while (true) { //무한 루프 + //1. + if (board[r][c] != CLEAN) { //현재 칸이 아직 청소되지 않은 경우, + cnt++; //청소한 칸 수를 늘리고, + board[r][c] = CLEAN; //현재 칸을 청소한다. } - - - // #2. 주변 4칸 청소 안된 곳 있으면, - if(dirtyPlaceExsist()) - { - tag = 0; // 전진 여부 표기할 태그값 초기화 - while(tag != 1) { - - // 1) 90도 회전 - d--; - if(d<0) d+=4; - //printf("돌아따 %d\n", d); - - - // 2) 바라보는 방향의 앞쪽 칸이 청소안돼있으면 전진 ! - switch(d) { - case 0 : //북 - if(room[r-1][c]==0) { - r--; - tag = 1; - break; - } - case 1 : //동 - if(room[r][c+1]==0) { - c++; - tag = 1; - break; - } - case 2 : //남 - if(room[r+1][c]==0) { - r++; - tag = 1; - break; - } - case 3 : //서 - if(room[r][c-1]==0) { - c--; - tag = 1; - break; - } - - } + bool find = false; //현재 칸의 주변 4칸 중 청소되지 않은 빈 칸이 있는가 + for (int i = 0; i < 4; i++) { //3-1. 반시계 방향으로 90º 회전 + int nd = (d - i + 3) % 4; //0->3->2->1->0->3 ... 의 순서로 돌며 계속 방향 회전함 + int nr = r + dy[nd], nc = c + dx[nd]; //바라보는 방향 기준, 한 칸 전진한 값 + + if (board[nr][nc] == 0) { //3-2. + find = true; //아직 청소되지 않은 빈 칸 발견 + r = nr; c = nc; d = nd; //전진 + break; } - - } - - - - // #2. 주변 4칸 청소 안된 곳 없으면, + if (find) { //3. 현재 칸의 주변 4칸 중 청소되지 않은 빈 칸이 있는 경우 1번으로 돌아감 + continue; + } - else - { - - // 후진 가능하면 후진. 벽이면 멈춤. - switch(d) { - case 0 : //북 - if(room[r+1][c]==1) { - return cnt; - } else { //벽 아니면 - r++; - break; - } - case 1 : //동 - if(room[r][c-1]==1) { - return cnt; - } else { //벽 아니면 - c--; - break; - } - case 2 : //남 - if(room[r-1][c]==1) { - return cnt; - } else { //벽 아니면 - r--; - break; - } - case 3 : //서 - if(room[r][c+1]==1) { - return cnt; - } else { //벽 아니면 - c++; - break; - } - } - - + //2. 현재 칸의 주변 4칸 중 청소되지 않은 빈 칸이 없는 경우 + int bd = (d + 2) % 4; //방향 180도 전환해서 + int br = r + dy[bd], bc = c + dx[bd]; //전진 좌표 저장 (즉, 원래 위치에서의 후진 좌표) + + //[바라보는 방향을 유지한 채로 한 칸 후진할 수 있는가] + //2-2. + if (board[br][bc] == 1) { //뒤쪽 칸이 벽이라 후진할 수 없는 경우 + return cnt; // 종료. 무한루프 탈출 } + //2-1. 바라보는 방향을 유지한 채로 한 칸 후진 + r = br; c = bc; //후진 } - - - - - return cnt; - + return cnt; // 청소한 칸 수 리턴 } -int main() -{ - - cin >> n >> m >> r >> c >> d; - - for(int i=0; i> room[i][j]; +/* +[로봇 청소기 작동] +1. 현재 칸이 아직 청소되지 않은 경우, 현재 칸을 청소한다. +2. 현재 칸의 주변 4칸 중 청소되지 않은 빈 칸이 없는 경우, + 2-1. 바라보는 방향을 유지한 채로 한 칸 후진할 수 있다면 한 칸 후진하고 1번으로 돌아간다. + 2-2. 바라보는 방향의 뒤쪽 칸이 벽이라 후진할 수 없다면 작동을 멈춘다. +3. 현재 칸의 주변 4칸 중 청소되지 않은 빈 칸이 있는 경우, + 3-1. 반시계 방향으로 90º 회전한다. + 3-2. 바라보는 방향을 기준으로 앞쪽 칸이 청소되지 않은 빈 칸인 경우 한 칸 전진한다. + 3-3. 1번으로 돌아간다. +*/ + +int main() { + ios::sync_with_stdio(false); + cin.tie(NULL); cout.tie(NULL); + + //입력 + int n, m, r, c, d; //방 크기, 로봇 청소기 정보 + cin >> n >> m; + cin >> r >> c >> d; + + vector> board(n, vector(m, 0)); //이차원 벡터 + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + cin >> board[i][j]; } } - cout << cleanRobot(); + //연산 & 출력 + cout << clean(n, m, r, c, d, board); return 0; } \ No newline at end of file