Skip to content

Commit

Permalink
22.08.02
Browse files Browse the repository at this point in the history
  • Loading branch information
delena0702 authored Aug 2, 2022
1 parent 2346298 commit 3e1d0eb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions BAEKJOON/14595_동방_프로젝트_(Large).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys
def input(): return sys.stdin.readline().strip()

N, M = int(input()), int(input())

data = [0] * N
for _ in range(M):
x, y = map(int, input().split())
data[x - 1] = y - 1

answer, e = 0, 0
for i in range(N):
e = max(e, data[i])
if i == e:
answer, e = answer + 1, e + 1

print(answer)

0 comments on commit 3e1d0eb

Please sign in to comment.