
#include #include long long tree[600000] = {}, start[200001]={}, end[200001]={}, dif[200001] = {}, ETT=0;char v[200001] = {};typedef struct list{ //단방향 리스트 struct list * next; long long val;}list;void insert(int x, int y, list vec[]) { //리스트 삽입, x을 기준으로 봅니다. list * newNode = (list*) malloc(sizeof(list)); newNode->val = y; newNode->next = vec[x].next; vec[x].next = newNode;}void dfs(int x, int y,..
#include #include int tree[266000]={}, start[100001]={}, end[100001]={}, ETT=0;char lazy[266000]={};typedef struct list{ //단방향 리스트 struct list * next; int val;}list;void insert(int x, int y, list vec[]) { //리스트 삽입 list * newNode = (list*) malloc(sizeof(list)); newNode->val = y; newNode->next = vec[x].next; vec[x].next = newNode; return;}void dfs(int x, list vec[]) { //ETT start[x] = ++ETT; for(l..
#include #include int tree[266000] = {}, ETT=0;typedef struct list { //단뱡향 리스트 struct list * next; int val; }list;void insert(int x, int y, list vec[]) { //리스트 삽입 list * newNode = (list*) malloc(sizeof(list)); newNode->val = y; newNode->next = vec[x].next; vec[x].next = newNode; return;}void dfs(int x, int start[], int end[], list vec[]) { //ETT start[x] = ++ETT; for(list *p = vec[x].next; p!=NU..
#include #include int ETT = 0; //오일로 경로 트릭을 위한 변수int tree[266000]={}, lazy[266000]={}, arr[100001]={}; //lazy propagationtypedef struct list{ //리스트 자료구조를 위한 구조체 struct list * prev; struct list * next; int val;}list;void insert(int s, int val, list vec[]) { //리스트에 삽입 list * newNode = (list*) malloc(sizeof(list)); newNode->val = val; newNode->next = vec[s].next; newNode->prev ..

#include #include int tree[266000]={},lazy[266000]={}; //lazy propagationint ETT = 0; //오일러 경로 트릭에 사용할 변수typedef struct list { //리스트를 구성할 노드의 구조체 struct list * prev; struct list * next; int val;} list;void insert(int sup, int sub, list vec[]) { //리스트 삽입 list *newNode = (list*) malloc(sizeof(list)); newNode->val = sub; newNode->prev = vec+sup; newNode->next = vec[sup].next; ..
#include #include typedef struct A{int x,y;}A; //x index, y power (입력값을 저장할 구조체)int tree[2000000] = {}; //segment tree (n의 최댓값 50만 * 4)int compare(const void *a, const void *b) { //qsort, 오름차순 정렬, 구조체 y값 기준 return (*(A*)a).y - (*(A*)b).y;//왼쪽이 더 크면 +, 오른쪽이 더 크면 -, 같다면 0}int find(int s, int e, int node, int l, int r) { //segment tree 탐색 if(s > r || e e) return; tree[node] += dif; if(s==e) return..
#include typedef struct Node {//최솟값과 최댓값을 담을 노드를 만들었습니다. int max; int min; }Node; Node a[100001]; //요소를 입력받을 Node 배열입니다. Node tree[400001]; //트리를 구성할 배열입니다. Node limit = {0, 1000000001}; Node minMax(Node x, Node y) { //두개의 Node형 변수를 비교하여, 최댓값과, 최솟값을 구합니다. Node res; res.max = (x.max > y.max) ? x.max : y.max; res.min = (x.min < y.min) ? x.min : y.min; return res; } Node init(int start, int end, in..

#include long long arr[100001] = {}; long long tree[100001] = {}; int n, q; void update(int i, long long x) { //트리의 값을 수정합니다. while(i y라면 y부터 x까지의 구간합을 출력해야 합니다. https://www.acmicpc.net/problem/1275 1275번: 커피숍2 첫째 줄에 수의 개수 N과 턴의 개수 Q가 주어진다.(1 ≤ N, Q ≤ 100,000) 둘째 줄에는 처음 배열에 들어가 있는 정수 N개가 주어진다. 세 번째 줄에서 Q+2번째 줄까지는 x y a b의 형식으로 x~y까지의 합 www.acmicpc.net
- Total
- Today
- Yesterday
- 1835번
- java
- DP
- 최소 스패닝 트리
- XOR
- C++
- 백준
- Segment Tree
- Krustal
- DFS
- 정렬
- 브루트포스
- Lazy Propagation
- 최대공약수
- 그래프
- union
- PASCAL
- 누적 합
- 오프라인 쿼리
- 스택
- 세그먼트 트리
- 플로이드
- 그리디
- 1835
- find
- BFS
- 덱
- 누적합
- C언어
- 기하학
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |