-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathABC1_D.py
More file actions
38 lines (38 loc) · 746 Bytes
/
ABC1_D.py
File metadata and controls
38 lines (38 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
n=int(input())
imos=[0]*1440
start=100000
end=0
sta=[]
end=[]
fr1=0
en1=0
fr2=0
en2=0
for i in range(n):
a,b=input().split('-')
a=int(a)
b=int(b)
a=(a%100)+(a-a%100)/100*60
b=(b%100)+(b-b%100)/100*60
a=a-(a%5)
b=b+(5-(b%5))
a=int(a)
b=int(b)
imos[a]+=1
imos[b+1]-=1
for i in range(1,1440):
imos[i]+=imos[i-1]
for i in range(1440):
if imos[i]>0:
start=min(start,i)
sta.append(start)
for j in range(i,1440):
if imos[j]==0:
end.append(j)
break
for i in range(len(sta)):
fr1=sta[i]//60
en1=sta[i]%60
fr2=end[i]//60
en2=end[i]%60
print('{}{}-{}{}'.format(fr1,en1,fr2,en2))