c++ 14897번 서로 다른 수와 쿼리 1 (백준)
#include #include #include #include #include using namespace std; int n, m, nSqrt, cnt=1; struct Query { //쿼리를 담을 구조체 int s, e, i; bool operator < (Query &other) { //sort에서 구조체타입의 비교 연산을 위해 연산자 오버로딩, Mo.s 알고리즘 이용 int a = s/nSqrt; int b = other.s/nSqrt; if(a != b) return a < b; //1. start/N의 제곱근이 더 작은것이 우선 return e < other.e; //2. 1.의 값이 같다면 end값이 더 작은 쿼리가 우선 } }; int main(void) { map M; //좌표압축을 ..
c++/BAEKJOON
2023. 7. 14. 18:41
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- C++
- 덱
- PASCAL
- Segment Tree
- C언어
- 1835
- BFS
- 누적합
- Krustal
- find
- java
- DFS
- 백준
- 누적 합
- 그리디
- 기하학
- 오프라인 쿼리
- 1835번
- DP
- Lazy Propagation
- union
- 세그먼트 트리
- 정렬
- 그래프
- XOR
- 브루트포스
- 최소 스패닝 트리
- 최대공약수
- 스택
- 플로이드
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함