Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

37-H0ngJu #262

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
| 34μ°¨μ‹œ | 2024.11.19 | λˆ„μ ν•© | [개λ˜₯벌레](https://www.acmicpc.net/problem/3020) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/256 |
| 35μ°¨μ‹œ | 2024.11.23 | DP | [전깃쀄](https://www.acmicpc.net/problem/2565) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/258 |
| 36μ°¨μ‹œ | 2024.12.02 | μˆ˜ν•™ | [머리 톑톑](https://www.acmicpc.net/problem/1241) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/260 |
| 36μ°¨μ‹œ | 2024.12.31 | 그리디 | [νšŒμ˜μ‹€ λ°°μ •](https://www.acmicpc.net/problem/1931) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/261 |
24 changes: 24 additions & 0 deletions H0ngJu/그리디/νšŒμ˜μ‹€ λ°°μ •.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys

def input() : return sys.stdin.readline().rstrip()

N = int(input()) # 100000
info = [tuple(map(int, input().split())) for _ in range(N)]


info.sort(key=lambda x: (x[1], x[0]))
# μ΅œλŒ€ν•œ 많이 λ„£μœΌλ €λ©΄ 빨리 λλ‚˜λŠ” νšŒμ˜λ“€μ„ 정렬을 해야함
# ** λλ‚˜λŠ” μ‹œκ°„μ΄ 같은 경우λ₯Ό 고렀해야함 **

tmp_a,tmp_b = info[0][0], info[0][1]
answer = 1

for i in range(1,N):
a = info[i][0]
b = info[i][1]

if a >= tmp_b:
tmp_a, tmp_b = a, b
answer += 1

print(answer)
Loading