05-05 10:44
Recent Posts
Recent Comments
관리 메뉴

너와나의 관심사

c++ 구조체와set 을 써서 sorting 하기 예제 본문

coding Algorithm/코딩테스트

c++ 구조체와set 을 써서 sorting 하기 예제

벤치마킹 2022. 4. 25. 03:18
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
 
struct Data {
 
    int id, score;
 
    void insert(int _id, int _score) {
        id = _id, score = _score;
    }
 
}Student[MAX_ID];
 
 
struct Comp
{
 
    bool operator () (int a, int b) const {
 
        if (Student[a].score != Student[b].score)
            return Student[a].score < Student[b].score;
 
        return Student[a].id < Student[b].id;
    }    
};
 
set <int, Comp> StudentSet[4][3];
cs

'coding Algorithm > 코딩테스트' 카테고리의 다른 글

union find 예제코드  (0) 2021.10.14
Comments