목록행렬 (35)
넘치게 채우기
https://leetcode.com/problems/rotating-the-box/description/leetcode - Rotating the Box문제 유형: 구현, 행렬, 시뮬레이션문제 난이도: Medium 문제You are given an m x n matrix of characters box representing a side-view of a box. Each cell of the box is one of the following:A stone '#'A stationary obstacle '*'Empty '.'The box is rotated 90 degrees clockwise, causing some of the stones to fall due to gravity. Each stone..
https://leetcode.com/problems/flip-columns-for-maximum-number-of-equal-rows/description/leetcode - Flip Columns For Maximum Number of Equal Rows문제 유형: 비트마스킹, 행렬문제 난이도: Medium 문제You are given an m x n binary matrix matrix.You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the cell from 0 to 1 or vice versa).Return the maximum number of..
https://leetcode.com/problems/count-unguarded-cells-in-the-grid/description/leetcode - Count Unguarded Cells in the Grid문제 유형: 행렬, 완전 탐색문제 난이도: Medium 문제You are given two integers m and n representing a 0-indexed m x n grid. You are also given two 2D integer arrays guards and walls where guards[i] = [rowi, coli] and walls[j] = [rowj, colj] represent the positions of the ith guard and jth wall re..
https://www.acmicpc.net/problem/11660BOJ - 구간 합 구하기 5문제 유형: 행렬, 다이나믹 프로그래밍, 부분합문제 난이도: Silver I시간 제한: 1초메모리 제한: 256MB 문제N×N개의 수가 N×N 크기의 표에 채워져 있다. (x1, y1)부터 (x2, y2)까지 합을 구하는 프로그램을 작성하시오. (x, y)는 x행 y열을 의미한다.예를 들어, N = 4이고, 표가 아래와 같이 채워져 있는 경우를 살펴보자.1234234534564567여기서 (2, 2)부터 (3, 4)까지 합을 구하면 3+4+5+4+5+6 = 27이고, (4, 4)부터 (4, 4)까지 합을 구하면 7이다.표에 채워져 있는 수와 합을 구하는 연산이 주어졌을 때, 이를 처리하는 프로그램을 작성하시오...
https://www.acmicpc.net/problem/10830BOJ - 행렬 제곱문제 유형: 행렬, 재귀, 분할 정복문제 난이도: Gold IV시간 제한: 1초메모리 제한: 256MB 문제크기가 N*N인 행렬 A가 주어진다. 이때, A의 B제곱을 구하는 프로그램을 작성하시오. 수가 매우 커질 수 있으니, A^B의 각 원소를 1,000으로 나눈 나머지를 출력한다. 입력첫째 줄에 행렬의 크기 N과 B가 주어진다. (2 ≤ N ≤ 5, 1 ≤ B ≤ 100,000,000,000)둘째 줄부터 N개의 줄에 행렬의 각 원소가 주어진다. 행렬의 각 원소는 1,000보다 작거나 같은 자연수 또는 0이다. 출력첫째 줄부터 N개의 줄에 걸쳐 행렬 A를 B제곱한 결과를 출력한다. 풀이행렬 A가 있다고 해보자. 행렬 ..
https://leetcode.com/problems/maximum-number-of-moves-in-a-grid/?envType=daily-question&envId=2024-10-29leetcode - Maximum Number of Moves in a Grid문제 유형: 다이나믹 프로그래밍, 재귀, dfs, 행렬문제 난이도: Medium 문제You are given a 0-indexed m x n matrix grid consisting of positive integers.You can start at any cell in the first column of the matrix, and traverse the grid in the following way:From a cell (row, col),..
https://codeforces.com/contest/2033/problem/BCodeforces Round 981(Div.3) - B. Sakurako and Water문제 유형: 구현, 행렬시간 제한: 2초메모리 제한: 256MB 문제During her journey with Kosuke, Sakurako and Kosuke found a valley that can be represented as a matrix of size n×n">n×n, where at the intersection of the i">i-th row and the j">j-th column is a mountain with a height of ai,j">ai,j. If ai,j<0">ai,j0, then..
https://leetcode.com/problems/count-square-submatrices-with-all-ones/description/?envType=daily-question&envId=2024-10-27leetcode - Count Square Submatrices with All Ones문제 유형: 다이나믹 프로그래밍, 행렬문제 난이도: Medium 문제Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.m * n의 크기의 0과 1로만 이루어진 행렬이 있다. 몇 개의 1로만 이루어진 정사각형 부분행렬이 존재하는지 구하시오. 풀이우선, 1인 칸 하나하나는 각각 자신, 즉 1x1의 부분..
https://www.acmicpc.net/problem/1080BOJ - 1080: 행렬문제 유형 : 행렬, 그리디, 비트마스크문제 난이도 : Silver I 문제0과 1로만 이루어진 행렬 A와 행렬 B가 있다. 이때, 행렬 A를 행렬 B로 바꾸는데 필요한 연산의 횟수의 최솟값을 구하는 프로그램을 작성하시오.행렬을 변환하는 연산은 어떤 3×3크기의 부분 행렬에 있는 모든 원소를 뒤집는 것이다. (0 → 1, 1 → 0) 입력첫째 줄에 행렬의 크기 N M이 주어진다. N과 M은 50보다 작거나 같은 자연수이다. 둘째 줄부터 N개의 줄에는 행렬 A가 주어지고, 그 다음줄부터 N개의 줄에는 행렬 B가 주어진다. 출력첫째 줄에 문제의 정답을 출력한다. 만약 A를 B로 바꿀 수 없다면 -1을 출력한다. 풀이이 ..
https://leetcode.com/problems/spiral-matrix-iv/description/?envType=daily-question&envId=2024-09-04leetcode - Spiral Matrix IV문제 유형 : 행렬, 연결 리스트문제 난이도 : Medium 문제You are given two integers m and n, which represent the dimensions of a matrix.You are also given the head of a linked list of integers.Generate an m x n matrix that contains the integers in the linked list presented in spiral order (cl..