목록생활 (730)
No Rules Rules
연구소 https://www.acmicpc.net/problem/14502 14502번: 연구소 인체에 치명적인 바이러스를 연구하던 연구소에서 바이러스가 유출되었다. 다행히 바이러스는 아직 퍼지지 않았고, 바이러스의 확산을 막기 위해서 연구소에 벽을 세우려고 한다. 연구소는 크 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include #include using namespace std; int N, M, ans, dx[4], dy[4], arr[9][9]; bool check[9][9], visit[9][9]; vector virus; int bfs(int(*maps)[9]) { memset(vi..
줄 세우기 https://www.acmicpc.net/problem/2252 2252번: 줄 세우기 첫째 줄에 N(1 ≤ N ≤ 32,000), M(1 ≤ M ≤ 100,000)이 주어진다. M은 키를 비교한 회수이다. 다음 M개의 줄에는 키를 비교한 두 학생의 번호 A, B가 주어진다. 이는 학생 A가 학생 B의 앞에 서야 한다는 의 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N, M, chk[32001]; vector ..
RGB거리 2 https://www.acmicpc.net/problem/17404 17404번: RGB거리 2 첫째 줄에 집의 수 N(2 ≤ N ≤ 1,000)이 주어진다. 둘째 줄부터 N개의 줄에는 각 집을 빨강, 초록, 파랑으로 칠하는 비용이 1번 집부터 한 줄에 하나씩 주어진다. 집을 칠하는 비용은 1,000보다 작거나 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N, ans = static_cast(1e8), arr[1000][3], dp[1000][3]; cin ..
MooTube (Silver) https://www.acmicpc.net/problem/15591 15591번: MooTube (Silver) 농부 존은 1번 동영상과 2번 동영상이 USADO 3을 가지고, 2번 동영상과 3번 동영상이 USADO 2를 가지고, 2번 동영상과 4번 동영상이 USADO 4를 가진다고 했다. 이것에 기반해서 1번 동영상과 3번 동영상의 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N, Q; set..
등산코스 정하기 https://school.programmers.co.kr/learn/courses/30/lessons/118669 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr // woohyeon.kim // kim519620.tistory.com #include #include #include #include #include using namespace std; set arr[50001]; int ans[50001]; char tmp[50001]; vector solution(int n, vector paths, vector gates, vector..
거울 설치 https://www.acmicpc.net/problem/2151 2151번: 거울 설치 첫째 줄에 집의 크기 N (2 ≤ N ≤ 50)이 주어진다. 다음 N개의 줄에는 N개의 문자로 집에 대한 정보가 주어진다. ‘#’는 문이 설치된 곳으로 항상 두 곳이며, ‘.’은 아무 것도 없는 것으로 빛은 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N, x, y, dist[51][51][4], dx[4]{0..
로봇 청소기 https://www.acmicpc.net/problem/4991 4991번: 로봇 청소기 각각의 테스트 케이스마다 더러운 칸을 모두 깨끗한 칸으로 바꾸는 이동 횟수의 최솟값을 한 줄에 하나씩 출력한다. 만약, 방문할 수 없는 더러운 칸이 존재하는 경우에는 -1을 출력한다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; int W, H, SX, SY, ans, dx[4], dy[4], dist[21][21]; char arr[21][21]; bool visit[21][21]; pair dusts[11]; int dust_permutate..
레이저 통신 https://www.acmicpc.net/problem/6087 6087번: 레이저 통신 크기가 1×1인 정사각형으로 나누어진 W×H 크기의 지도가 있다. 지도의 각 칸은 빈 칸이거나 벽이며, 두 칸은 'C'로 표시되어 있는 칸이다. 'C'로 표시되어 있는 두 칸을 레이저로 통신하기 위해서 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include #include using namespace std; int W, H, dx[4], dy[4], dist[101][101]; char arr[101][101]; vector lasers; void bfs(register int x, regi..

업무상 리눅스OS가 탑재된 보드 내에서 차트 이미지를 생성해야 하는 일이 생겼습니다. 여러가지 라이브러리와 프로그램을 찾아보았습니다만 가장 사용량이 많은 gnuplot을 사용하기로 했습니다. 이미지를 생성하는 역할만을 본다면 가장 빠르고 멀티플랫폼을 지원한다는 장점 등이 이유입니다. gnuplot은 명령어를 전달하여 이미지를 생성할 수 있는 방식입니다. 따라서 리눅스 커맨드를 전송하여 설정을 할 수 있습니다. 현재 실행하는 프로세스에서 gnuplot을 실행하는 것은 효율적이지 못합니다. 다른 프로세스의 gnuplot을 이용하여 나의 프로그램과 gnuplot 프로세스를 따로 분리시켜 주는 것이 유리합니다. 따라서 다른 프로세스의 입출력을 제어할 수 있는 popen을 통해 gnuplot을 수행합니다. FIL..
미네랄 https://www.acmicpc.net/problem/2933 2933번: 미네랄 창영과 상근은 한 동굴을 놓고 소유권을 주장하고 있다. 두 사람은 막대기를 서로에게 던지는 방법을 이용해 누구의 소유인지를 결정하기로 했다. 싸움은 동굴에서 벌어진다. 동굴에는 미네랄 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include #include using namespace std; int R, C, N, H, dx[4], dy[4]; char arr[101][101]; bool visit[101][101]; vector clusters;// (클러스터) inline int left_stick(..