Last active
September 14, 2017 15:57
-
-
Save IKKO-Ohta/7b6151e876b45170a25f025d6e911446 to your computer and use it in GitHub Desktop.
ABC01[D].py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = int(input()) | |
imos = [0 for i in range(1443)] | |
def mystart(a_minute): | |
while(1): | |
if a_minute % 5 == 0 : break | |
a_minute -=1 | |
return a_minute | |
def myend(a_minute): | |
while(1): | |
if a_minute % 5 == 0 : break | |
a_minute += 1 | |
return a_minute | |
def output_time(a_minute): | |
h = a_minute // 60 | |
h = '%02d'% h | |
m = a_minute % 60 | |
m = '%02d'% m | |
return h+m | |
for i in range(N): | |
time = [t for t in input().split("-")] | |
time = [int(t[:2])*60 + int(t[2:]) for t in time] | |
time = [mystart(time[0]),myend(time[1])] | |
nums.append(time) | |
for n in nums: | |
imos[n[0]] += 1 | |
imos[n[1]+1] -= 1 | |
ans = [] | |
j = 0 | |
for i in imos: | |
ans.append(j+i) | |
j += i | |
start,end,flag = 0,0,False | |
for i in range(len(ans)): | |
if ans[i] == 0 and flag == False : continue | |
elif ans[i] == 0 and flag == True: | |
end = i | |
print(output_time(start) + "-" + output_time(end-1)) | |
start,end,flag = 0,0,False | |
elif ans[i] != 0 and flag == False : | |
start = i | |
flag = True | |
else: | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment