Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created October 28, 2013 12:04
Show Gist options
  • Save cocodrips/7195717 to your computer and use it in GitHub Desktop.
Save cocodrips/7195717 to your computer and use it in GitHub Desktop.
SRM595 Div2 500
class LittleElephantAndIntervalsDiv2:
def getNumber(self, M, L, R):
s = set()
count = 0
for i in reversed(xrange(0, len(L))):
is_paint = False
for n in range(L[i], R[i]+1):
if n not in s:
is_paint = True
s.add(n)
else:
if is_paint:
count += 1
return pow(2, count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment