본문 바로가기

분류 전체보기115

[BOJ/C++]11651번_좌표 정렬하기2 https://www.acmicpc.net/problem/11651 ##문제 풀기 전 내가 알고 있었어야 할 개념:★ Vector(or 다른 선형 자료구조)와 Sort() 사용방법 :1_ Compare() 메소드 작성법 :2_ qsort() + 배열  vs sort() + vector(또는 다른 선형 자료구조)  사용법 차이 비교  123456789101112131415161718192021222324252627282930313233343536373839404142434445#include iostream>#include vector>#include algorithm> using namespace std; void init() {     ios::sync_with_stdio(false);    cin.t.. 2024. 7. 10.
[BOJ/C++]10989번_수정렬하기3 https://www.acmicpc.net/problem/10989 ##문제 풀기 전 내가 알고 있었어야 할 개념:1_ 메모리 초과 문제 :=> 1차 시도의 메모리 초과 이유 : 헤더파일 + qsort 연산에서 공간 메모리 초과 사용2_ Time Limit => 시간 복잡도 : 2_1) 보통의 과정 (버블정렬, 퀵정렬...) 에서 O(n^2)의 이상의 시간 복잡도가 나온다. 2_ 2) 에서 사용되는 cin, cout, endl 등등의 표준 stream 동기화 시간=> (2_2)의 해결방법 : [코드]에 있는 init()함수 선언, 호출 123456void init() {     ios::sync_with_stdio(false);    cin.tie(0);    cout.tie(0);}cs3_ 문제 원리.. 2024. 7. 10.
[BOJ/C++]25305번_커트라인 https://www.acmicpc.net/problem/25305 ##문제 풀기 전 내가 알고 있었어야 할 개념: 없음123456789101112131415161718192021222324252627282930313233#include iostream>#include algorithm> using namespace std; int compare(const void* a, const void* b) {    return (*(int*)b - *(int*)a);} int main() {     ios::sync_with_stdio(false);    cin.tie(0);    cout.tie(0);     int N,K;    int* scores;    cin >> N >> K;     scores = .. 2024. 7. 10.
(6)[Chapter4]분리집합_이론,코드구현 ##분리집합 이론 노트 정리##분리집합 코드 구현  12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879#include stdio.h>#include stdlib.h> //분리 집합 구조체typedef struct _DS_Set {    struct _DS_Set* Parent;    void* Data;}Set; //원소(1개짜리 원소 집합) 생성 메소드Set* MakeSet(void* Data) {    Set* newSet = (Set*)malloc(sizeof(Set));    newS.. 2024. 7. 8.