diff --git "a/BAEKJOON/14595_\353\217\231\353\260\251_\355\224\204\353\241\234\354\240\235\355\212\270_(Large).py" "b/BAEKJOON/14595_\353\217\231\353\260\251_\355\224\204\353\241\234\354\240\235\355\212\270_(Large).py" new file mode 100644 index 0000000..fbbe47b --- /dev/null +++ "b/BAEKJOON/14595_\353\217\231\353\260\251_\355\224\204\353\241\234\354\240\235\355\212\270_(Large).py" @@ -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) \ No newline at end of file