목록2024/05/09 (2)
알고리즘 모음(C++)

문제 링크입니다. https://www.acmicpc.net/problem/14438 세그먼트 트리를 이용한 문제입니다. 자세한 것은 코드를 참고해주세요.#define _CRT_SECURE_NO_WARNINGS#include #include #include #include #include #include #include #include #include #define INF LLONG_MAXusing namespace std;int N, M;long long Index[100001];vector Tree;long long segment_tree(int st, int fin, int node) { if (st == fin) return Tree[node] = st; int mid = (st + fin) /..

문제 링크입니다. https://www.acmicpc.net/problem/14428 세그먼트 트리를 이용한 문제입니다. 자세한 것은 코드를 참고해주세요.#define _CRT_SECURE_NO_WARNINGS#include #include #include #include #include #include #include #include #include #define INF LLONG_MAXusing namespace std;int N, M;long long Index[100001];vector Tree;long long segment_tree(int st, int fin, int node) { if (st == fin) return Tree[node] = st; int mid = (st + fin) /..