Skip to content

Commit

Permalink
Merge pull request #57 from AlgoLeadMe/16-alstjr7437
Browse files Browse the repository at this point in the history
16-alstjr7437
  • Loading branch information
alstjr7437 authored Mar 23, 2024
2 parents 8e79b88 + 80235f8 commit 1ab6ea1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions alstjr7437/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
| 13์ฐจ์‹œ | 2024.02.29 | DP | <a href="https://www.acmicpc.net/problem/10844">์‰ฌ์šด ๊ณ„๋‹จ ์ˆ˜</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/42 |
| 14์ฐจ์‹œ | 2024.03.03 | ๋ธŒ๋ฃจํŠธํฌ์Šค | <a href="https://www.acmicpc.net/problem/18111">๋งˆ์ธํฌ๋ž˜ํ”„ํŠธ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/48 |
| 15์ฐจ์‹œ | 2024.03.09 | ์šฐ์„ ์ˆœ์œ„ ํ | <a href="https://www.acmicpc.net/problem/13975">ํŒŒ์ผ ํ•ฉ์น˜๊ธฐ3</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/53 |
| 16์ฐจ์‹œ | 2024.03.13 | ์ •๋ ฌ | <a href="https://www.acmicpc.net/problem/2170">์„  ๊ธ‹๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/57 |
3 changes: 3 additions & 0 deletions alstjr7437/์ •๋ ฌ/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# dohwaji[i][0] += 1000000000
# dohwaji[i][1] += 1000000000
27 changes: 27 additions & 0 deletions alstjr7437/์ •๋ ฌ/์„  ๊ธ‹๊ธฐ.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 1ab6ea1

Please sign in to comment.