[C++ Korea] Effective Modern C++ Study item14 16 +신촌Seok-joon Yun[C++ Korea] Effective Modern C++ Study item14 16 +신촌
Item 14 : Declare functions noexcept if they won't emit exceptions. +윤석준
Item 15 : Use constexpr whenever possible. +이동우
Item 16 : Make const member functions thread safe. +제한재
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...Seok-joon Yun[C++ Korea] Effective Modern C++ Study
Item 19 Use shared_ptr for shared-ownership resource management
공유자원 관리엔 std::shared_ptr을 사용하자.
+윤석준
[C++ korea] effective modern c++ study item 14 declare functions noexcept if ...Seok-joon Yun[C++ Korea] Effective Modern C++ Study (신촌) Item 14
Declare functions noexceptif they won’t emit exceptions.
예외를 발생하지 않는 함수인 경우 noexcept를 선언하자.
- 윤석준
[C++ korea] effective modern c++ study item 2 understanding auto type deduc...Seok-joon Yun[C++ korea] effective modern c++ study (신촌) item 2 understanding auto type deduction +옥찬호
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...Seok-joon Yun[C++ Korea] Effective Modern C++ Study (신촌) Item 7
Distinguish between () and {} when creating objects.
Object를 생성할 때 ()와 {}를 구분하라.
- 윤석준
[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23Seok-joon Yun[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23
Item 20, 21, 23
Item 20 : Use std::weak_ptr for std::shared_ptr-like pointers that can dangle. +정은식
Item 21 : Prefer std::make_unique and std::make_shared to direct use of new. +이동우
Item 23 : Understand std::move and std::forward. +제한재
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...Seok-joon Yun[C++ Korea] Effective Modern C++ MVA Item 9 Prefer alias declarations to typedefs +윤석준
[C++ Korea] Effective Modern C++ Study item 24-26Seok-joon Yun[C++ Korea] Effective Modern C++ Study item 24-26
Item 24: Distinguish universal references from rvalue references. +석정로
Item 25 : Use std::move on rvalue references,
std::forward on universal references. +서승덕
Item 26 : Avoid overloading on universal references. +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준Seok-joon Yun[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ korea] effective modern c++ study item 1 understand template type dedu...Seok-joon Yun[C++ Korea] Effective Modern C++ Study (신촌) - Item 1 Understand template type deduction +정은식
[C++ korea] effective modern c++ study item 2 understanding auto type deduc...Seok-joon Yun[C++ korea] effective modern c++ study (신촌) item 2 understanding auto type deduction +옥찬호
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...Seok-joon Yun[C++ Korea] Effective Modern C++ Study (신촌) Item 7
Distinguish between () and {} when creating objects.
Object를 생성할 때 ()와 {}를 구분하라.
- 윤석준
[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23Seok-joon Yun[C++ korea] Effective Modern C++ 신촌 Study Item20,21,23
Item 20, 21, 23
Item 20 : Use std::weak_ptr for std::shared_ptr-like pointers that can dangle. +정은식
Item 21 : Prefer std::make_unique and std::make_shared to direct use of new. +이동우
Item 23 : Understand std::move and std::forward. +제한재
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...Seok-joon Yun[C++ Korea] Effective Modern C++ MVA Item 9 Prefer alias declarations to typedefs +윤석준
[C++ Korea] Effective Modern C++ Study item 24-26Seok-joon Yun[C++ Korea] Effective Modern C++ Study item 24-26
Item 24: Distinguish universal references from rvalue references. +석정로
Item 25 : Use std::move on rvalue references,
std::forward on universal references. +서승덕
Item 26 : Avoid overloading on universal references. +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준Seok-joon Yun[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ korea] effective modern c++ study item 1 understand template type dedu...Seok-joon Yun[C++ Korea] Effective Modern C++ Study (신촌) - Item 1 Understand template type deduction +정은식
Kitel algorithm 1진오 김From Standard I/O to recursive call.
Written in Korean.
It was used to teach club members which name is KITEL. So there are some jokes. Please do not hate me even though you are uncomfortable by my jokes...haha
알고리즘 연합캠프 세미나 2-C (Segment Tree)HYUNJEONG KIMLe document présente des notations mathématiques et des équations liées à des sommes et des séries. Des expressions sont simplifiées, et il semble aborder des concepts de complexité tels que o(1) et o(log n). Le contenu est principalement technique et axé sur la formulologie analytique.
알고리즘 연합캠프 세미나 1-B (Bitwise DP)HYUNJEONG KIMThe document discusses using bitwise operators and dynamic programming to solve problems efficiently. It provides examples of using bitwise OR, AND, XOR operators to add, remove and check for elements in a set represented as a bitmask. It then describes several problems involving bitmasks and dynamic programming including finding the number of possible paths in a graph and the maximum score in a traveling salesman problem. The examples demonstrate how bitwise operators can be used to optimize set operations and dynamic programming can reduce exponential time complexity problems to polynomial time.
shake! 2017 본선문제 풀이HYUNJEONG KIMThe document discusses several algorithms and data structures:
1. It discusses using dynamic programming to solve problems with optimal substructure in O(N^3) time, storing solutions to subproblems in 2D tables.
2. It presents the Knapsack problem and discusses a dynamic programming solution using a 3D DP table to store solutions for all possible combinations of items and capacity.
3. It discusses representing numbers in a factorial number system and calculating factorials efficiently using dynamic programming in O(logK) time.
shake! 2017 예선 문제 풀이HYUNJEONG KIMThis document discusses various algorithms and their time complexities:
1. Section A discusses sorting algorithms and their O(N) linear time complexity for small/large inputs.
2. Section B discusses interval intersection algorithms with O(M*N) quadratic time for small inputs using nested loops, and O(M*logM) logarithmic time for large inputs using disjoint set data structures.
3. Section C discusses image quilting algorithms with O(W*3H) cubic time for small images and O(W*H) linear time for large images using dynamic programming.
4. Section D discusses connected component labeling with linear time for small images using scanning and O(N*M) time for
26. ▪ vector나 queue, stack 등에서 원소를 넣을 때 emplace를 사용하면 constructor에 맞춰
서 원소가 들어간다.
27. ▪ C++11이 되면서 추가된 STL이 몇가지 있다.
▪ unordered_map
▪ unordered_multimap
▪ unordered_set
▪ unordered_multiset
▪ array
28. ▪ Hash를 이용하여 구현된 map으로 이론적으로는 O(1)의 시간복잡도를 가진 dictionary
이다.
▪ Hash를 이용하기 때문에 원소가 정렬이 되어있지는 않다.
▪ 기존의 std::map과 매우 유사하므로 거의 그대로 사용하면 된다.
▪ 다른 STL또한 큰 차이가 없으며, multi가 붙은 것은 원소를 중복해서 가질 수 있다.
29. ▪ Vector와 달리 크기가 고정된 정적 배열이다.
▪ 하지만 int[]와 같은 배열과 달리 STL 알고리즘 함수들에 적용이 가능하며, 그 외에도 다
양한 것을 지원한다.
▪ 그러나 메모리를 여유 있게 잡아 사용하는 대회에서는 크게 활용성은 없는 듯 하다;;
30. ▪ C++11 부터 정규표현식을 지원한다.
▪ 사용하기에 따라서 꽤 쓸 만하겠지만, 일단 패스
31. ▪ C++11에 추가된 것은 아니고, 기존에 있는 클래스이지만 간단하게 나마 다뤄볼까 한다.
▪ Bit의 경우 Bitmask를 통한 동적계획법 해결을 하는 경우가 있기 때문에 PS에서 종종 사
용된다.
▪ 대표적인 Bit 연산을 외워서 사용하여도 괜찮지만, 그것이 싫다면 Bitset을 찾아서 사용
해보는 것도 한 방법이 될 것이다.
38. ▪ 문제를 풀 때 각 상황별로 해결해야하는 사소한 문제들이 많다.
▪ 입력부터 시작하여 데이터는 어떻게 저장해야 하는가 등 아주 여러가지 상황에 직면한
다.
▪ 이러한 문제들을 해결할 때 각자 매우 다양하고 참신한 방법들로 해결한다.
▪ 이러한 문제들을 각자 해결하고 공유해보는 시간을 가지자.
39. 1. 붙어있는 숫자 떨어트려 받기
2. EOF
3. char 입력
4. 문자열 파싱해서 받기
48. ▪ 테스트 케이스의 수를 주는 경우도 있지만, 처음 입력이 전부 0이거나 아예 아무 입력도
안주어지는 경우 등 다양한 경우가 있다.
49. // 0 0 일 때 종료
int n,m;
scanf(“%d%d”,&n,&m);
if(n+m==0)break;
// EOF일때 종료
if(scanf(“%d%d”,&n,&m)==EOF)break;
50. ▪ for loop를 돌려 초기화를 해주는 경우도 있지만, memset함수를 이용하여 전체를 초기
화를 하는경우가 많다.
▪ 간혹 모든 테스트 케이스에 대해서 전체를 초기화하여 시간초과가 나는 경우가 있지만,
드문 경우라 많이들 사용한다.
51. ▪ memset(초기화 시작할 주소,초기화 할 값(1바이트),초기화할 바이트 수)
▪ int dy[50][50];
▪ memset(dy,0x3f,sizeof(dy)
▪ 0x7f : 0x7f7f7f7f memset으로 초기화 할 수 있는 최대 int 크기
▪ 0x3f : 0x3f3f3f3f 오버 플로우 방지를 위한 적당한 int 크기
▪ 0 : 0으로 초기화
▪ 0xff : -1로 초기화, 메모이제이션에서 많이 사용
▪ 0x80 : 0x80808080 memset으로 초기화 할 수 있는 최소 int크기
52. ▪ 문제를 풀다 보면 다양한 상수 값을 코드에 넣는다.
▪ const int MOD=1000000007;
▪ double PI=acos(-1);
▪ const int INF=0x7fffffff;
▪ const int INF=0x7fffffff/2; // overflow 방지
▪ const int MIN=0x80000000;
53. ▪ 간혹 입력으로 주어진 수열의 원소들의 중복을 제거하고 몇번째 원소인지 구해야 하는
경우가 있다.
▪ https://www.acmicpc.net/problem/10867
▪ 좌표 압축
54. set or map 사용
vector<int> arr ={1,3,6,3,2,3,1};
vector<int> X=arr;
std::sort(X.begin(),X.end());
X.erase(std::unique(X.begin(),X.end()),X.end());
for(int num:arr){
int idx=std::lower_bound(X.begin(),X.end(),num)-X.begin();
}
55. ▪ 간선의 정보가 주어졌을 때, 모든 정점을 한번씩 방문
▪ n*n 격자판에서 최단거리 찾기
▪ https://www.acmicpc.net/problem/7576
56. ▪ c++ 11문법의 typedef과 같은 역할 외에도 많은 일을 한다.
▪ 많은 사람들이 using namespace std;를 사용하는데 이는 전역변수를 선언할 때, std
namespace안에 있는 무언가와 겹치는 경우 컴파일 에러가 난다.
▪ using std::vector; 와 같은 방법을 사용하면 필요한 것만 가져와 명시적으로 표현하기에
이에 대한 에러를 대비할 수 있다.
57. ▪ 문제 중 string 을 숫자로 바꿔서 풀어야 하는 경우가 있다.
▪ https://www.acmicpc.net/problem/13168