diff --git a/honggukang0623/.DS_Store b/honggukang0623/.DS_Store new file mode 100644 index 0000000..ec44c9b Binary files /dev/null and b/honggukang0623/.DS_Store differ diff --git a/oesnuj/README.md b/oesnuj/README.md index d0b1139..586d2a4 100644 --- a/oesnuj/README.md +++ b/oesnuj/README.md @@ -17,4 +17,5 @@ | 13차시 | 2024.07.28 | DP | [부녀회장이 될테야](https://www.acmicpc.net/problem/2775) | [#44](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/44) | | 14차시 | 2024.08.05 | 해시 | [ 나는야 포켓몬 마스터 이다솜 ](https://www.acmicpc.net/problem/1620) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/46) | | 15차시 | 2024.08.10 | 그리디 | [ 주식 ](https://www.acmicpc.net/problem/11501) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/47) | +| 16차시 | 2024.09.13 | 구현 | [ 달력 ](https://www.acmicpc.net/problem/20207) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/50) | --- diff --git "a/oesnuj/\352\265\254\355\230\204/20207.cpp" "b/oesnuj/\352\265\254\355\230\204/20207.cpp" new file mode 100644 index 0000000..08b6bc3 --- /dev/null +++ "b/oesnuj/\352\265\254\355\230\204/20207.cpp" @@ -0,0 +1,42 @@ +#include +#include +using namespace std; + +struct EventPeriod +{ + int start, end; +}; + +int main() +{ + int N; + cin >> N; + vector v(N); + int days[365] = {0}; + + for(int i = 0; i < N; i++) + { + cin >> v[i].start >> v[i].end; //일정 시작일, 종료일 입력받기 + + for (int k = v[i].start - 1; k < v[i].end; k++) { + days[k]++; //일정에 포함되는 날의 배열 값 +1; + } + } + + int result = 0; + int height = 0, width = 0; + for (int i = 0; i < 365; i++) { + if (days[i] != 0) { + width++; + height = max(height, days[i]); + } + + if (days[i + 1] == 0) { + result += height * width; + width = 0; + height = 0; + } + } + cout << result; + return 0; +} \ No newline at end of file diff --git a/pu2rile/.DS_Store b/pu2rile/.DS_Store index 66ea887..a2036e2 100644 Binary files a/pu2rile/.DS_Store and b/pu2rile/.DS_Store differ diff --git a/pu2rile/README.md b/pu2rile/README.md index 9307979..9e8c156 100644 --- a/pu2rile/README.md +++ b/pu2rile/README.md @@ -18,4 +18,4 @@ | 14차시 | 2024.08.05 | 트리 | [이진 탐색 트리](https://www.acmicpc.net/problem/5639) | [#45](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/45) | 15차시 | 2024.08.15 | 트리 | [나무 탈출](https://www.acmicpc.net/problem/15900) | [#48](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/48) | 16차시 | 2024.09.15 | 그리디 알고리즘 | [신입 사원](https://www.acmicpc.net/problem/15900) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/51) -| 17차시 | 2024.09.24 | 문자열 | [콰트로치즈피자](https://www.acmicpc.net/problem/27964) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/54) +| 17차시 | 2024.09.24 | 문자열 | [콰트로치즈피자](https://www.acmicpc.net/problem/27964) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/54) \ No newline at end of file diff --git "a/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/\354\213\240\354\236\205 \354\202\254\354\233\220.py" "b/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/\354\213\240\354\236\205 \354\202\254\354\233\220.py" new file mode 100644 index 0000000..2fe538b --- /dev/null +++ "b/pu2rile/\352\267\270\353\246\254\353\224\224 \354\225\214\352\263\240\353\246\254\354\246\230/\354\213\240\354\236\205 \354\202\254\354\233\220.py" @@ -0,0 +1,19 @@ +T = int(input()) + +for _ in range(T): + N = int(input()) + score = [list(map(int, input().split())) for _ in range(N)] + + # 서류 심사 성적 기준으로 오름차순 정렬 + rank_1 = sorted(score) + top = 0 # 서류 성적이 가장 좋은 사람을 기준으로 설정 (첫 번째 사람) + result = 1 # 첫 번째 지원자는 항상 합격하므로 결과를 1로 시작 + + # 2번째 지원자부터 서류 성적 순으로 면접 성적 비교 + for i in range(1, len(rank_1)): + # 현재 지원자의 면접 성적이 기준점(top)의 지원자보다 좋으면 (숫자가 낮으면) + if rank_1[i][1] < rank_1[top][1]: + top = i # 기준점(top)을 현재 지원자로 갱신 + result += 1 + + print(result) \ No newline at end of file