목록Problem Solving (223)
Life Engineering
https://www.acmicpc.net/problem/17472 17472번: 다리 만들기 2 첫째 줄에 지도의 세로 크기 N과 가로 크기 M이 주어진다. 둘째 줄부터 N개의 줄에 지도의 정보가 주어진다. 각 줄은 M개의 수로 이루어져 있으며, 수는 0 또는 1이다. 0은 바다, 1은 땅을 의미한다. www.acmicpc.net #include using namespace std; int graph[11][11]; bool visited[11][11]; int parents[7]; int N, M; int dy[4]={-1,1,0,0}; int dx[4]={0,0,-1,1}; class Node{ public: int start; int end; int cost; Node(int start, int ..
https://www.acmicpc.net/problem/7578 7578번: 공장 어떤 공장에는 2N개의 기계가 2열에 걸쳐 N개씩 배치되어 있다. 이 2개의 열을 각각 A열과 B 열이라고 부른다. A열에 있는 N개의 기계는 각각이 B열에 있는 N개의 기계와 하나씩 짝을 이루어 케이블 www.acmicpc.net #include #define ll long long using namespace std; ll *tree; vector v; ll query(int left, int right, int node, int queryLeft, int queryRight){ if (right
https://www.acmicpc.net/problem/1238 1238번: 파티 첫째 줄에 N(1 ≤ N ≤ 1,000), M(1 ≤ M ≤ 10,000), X가 공백으로 구분되어 입력된다. 두 번째 줄부터 M+1번째 줄까지 i번째 도로의 시작점, 끝점, 그리고 이 도로를 지나는데 필요한 소요시간 Ti가 들어 www.acmicpc.net #include #define INF 987654321 using namespace std; class Node{ public: int id; int cost; Node(int id, int cost){ this->id=id; this->cost=cost; } }; struct compare{ bool operator()(const Node& a, const Node..
https://www.acmicpc.net/problem/17070 17070번: 파이프 옮기기 1 유현이가 새 집으로 이사했다. 새 집의 크기는 N×N의 격자판으로 나타낼 수 있고, 1×1크기의 정사각형 칸으로 나누어져 있다. 각각의 칸은 (r, c)로 나타낼 수 있다. 여기서 r은 행의 번호, c는 열의 www.acmicpc.net #include using namespace std; enum Pos {garo, sero, degak}; int house[17][17]; class Point{ public: int y; int x; Pos pos; Point(int y, int x, Pos pos){ this->y=y; this->x=x; this->pos=pos; } }; bool isPossibl..