-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.py
More file actions
42 lines (35 loc) · 882 Bytes
/
1.py
File metadata and controls
42 lines (35 loc) · 882 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
39
40
41
#3
#12:00 ~ 23:59
#11:00 ~ 18:00
#14:00 ~ 20:00
N = int(input())
timeList = [[0]*4 for _ in range(N)]
startH = -1
endH = 24
startM = -1
endM = 60
for i in range(N):
tmp = input()
timeList[i][0]= int(tmp[0:2])
timeList[i][1]= int(tmp[3:5])
timeList[i][2]= int(tmp[8:10])
timeList[i][3]= int(tmp[11:13])
if startH < timeList[i][0]:
startH=timeList[i][0]
startM = timeList[i][1]
elif startH == timeList[i][0]:
startH=timeList[i][0]
startM = max(startM,timeList[i][1])
if endH > timeList[i][2]:
endH = timeList[i][2]
endM = timeList[i][3]
elif endH == timeList[i][2]:
endH = timeList[i][2]
endM = min(endM,timeList[i][3])
#print(timeList)
if startH>endH:
print(-1)
elif (startH==endH and startM>endM):
print(-1)
else:
print("%02d:%02d ~ %02d:%02d"%(startH,startM,endH,endM))