Skip to content

Instantly share code, notes, and snippets.

@IKKO-Ohta
Created July 5, 2017 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IKKO-Ohta/686a815c0e244b81f3ecf8d473cc069e to your computer and use it in GitHub Desktop.
Save IKKO-Ohta/686a815c0e244b81f3ecf8d473cc069e to your computer and use it in GitHub Desktop.
N = int(input())
imos = [0 for i in range(10000001)]
for i in range(N):
nums = [int(x) for x in input().split()]
a,b = nums[0],nums[1]
imos[a] += 1
imos[b+1] -= 1
ans = []
j = 0
for i in imos:
ans.append(j+i)
j += i
print(max(ans))
N = int(input())
imos = [0 for i in range(10000001)]
for i in range(N):
nums = [int(x) for x in input().split()]
a,b = nums[0],nums[1]
imos[a] += 1
imos[b+1] -= 1
ans = []
j = 0
for i in imos:
ans.append(j+i)
j += i
print(max(ans))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment