Skip to content

Commit

Permalink
2024-03-13 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
alstjr7437 committed Mar 13, 2024
1 parent 7d531d4 commit 80235f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
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 80235f8

Please sign in to comment.