diff --git a/alstjr7437/README.md b/alstjr7437/README.md index f3af489..4b3dfca 100644 --- a/alstjr7437/README.md +++ b/alstjr7437/README.md @@ -17,3 +17,4 @@ | 13차시 | 2024.02.29 | DP | 쉬운 계단 수 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/42 | | 14차시 | 2024.03.03 | 브루트포스 | 마인크래프트 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/48 | | 15차시 | 2024.03.09 | 우선순위 큐 | 파일 합치기3 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/53 | +| 16차시 | 2024.03.13 | 정렬 | 선 긋기 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/57 | \ No newline at end of file diff --git "a/alstjr7437/\354\240\225\353\240\254/tempCodeRunnerFile.py" "b/alstjr7437/\354\240\225\353\240\254/tempCodeRunnerFile.py" new file mode 100644 index 0000000..01e1add --- /dev/null +++ "b/alstjr7437/\354\240\225\353\240\254/tempCodeRunnerFile.py" @@ -0,0 +1,3 @@ + +# dohwaji[i][0] += 1000000000 +# dohwaji[i][1] += 1000000000 \ No newline at end of file diff --git "a/alstjr7437/\354\240\225\353\240\254/\354\204\240 \352\270\213\352\270\260.py" "b/alstjr7437/\354\240\225\353\240\254/\354\204\240 \352\270\213\352\270\260.py" new file mode 100644 index 0000000..0bfd88f --- /dev/null +++ "b/alstjr7437/\354\240\225\353\240\254/\354\204\240 \352\270\213\352\270\260.py" @@ -0,0 +1,27 @@ +import sys +input = sys.stdin.readline + +n = int(input()) +dohwaji = [tuple(map(int,(input().split()))) for _ in range(n)] + +# for i in range(len(dohwaji)): +# dohwaji[i][0] += 1000000000 +# dohwaji[i][1] += 1000000000 + +dohwaji.sort() + +line = dohwaji[0][1] +answer = dohwaji[0][1] - dohwaji[0][0] + +for left, right in dohwaji[1:]: + if right <= line: + continue + elif line < left: + answer += right - left + line = right + elif line >= left and right > line: + answer += right - line + line = right + # print(answer) + +print(answer) \ No newline at end of file