Submission #4797445


Source Code Expand

from sys import stdin

def my_round(val, digit=0):
    p = 10 ** digit
    return (val * p * 2 + 1) // 2 / p
def rounded_time_before(time): # 前の時間用
	tmp = int(10 * my_round(time*0.1, 0))
	if time < float(tmp):
		tmp -= 5
	return tmp
def rounded_time_after(time): # 後の時間用
	if str(time)[-1] == "5":
		time -= 1
	tmp = int(10 * my_round(time*0.1, 0))
	if time > float(tmp):
		tmp += 5
	if str(tmp)[-2:] == "60":
		tmp += 40
	return tmp

N = int(stdin.readline().rstrip())
#SE = [[int(x) for x in stdin.readline().rstrip().split("-")] for _ in range(N)]
SE = [list(map(int, stdin.readline().rstrip().split("-"))) for _ in range(N)]
"""
for i in range(N):
    SE[i][0] = SE[i][0] - SE[i][0] % 5
 
    if (SE[i][1] % 5 != 0):
        SE[i][1] = SE[i][1] - SE[i][1] % 5 + 5
 
    tmp2 = SE[i][1] / 100
 
    if (tmp2 - int(tmp2) > 0.59999):
        SE[i][1] = (int(tmp2) + 1) * 100
    if (SE[i][1] >= 2360):
        SE[i][1] = 2400
"""
# state = [0] * 2401
# for before, after in SE:
# 	bf = int(rounded_time_before(before))
# 	af = int(rounded_time_after(after))
# 	state[bf:af+1] = [1]*(af-bf+1)
# #print(state)
# start_end = []
# flag = 0
# for i in range(len(state)):
# 	if flag == 0 and state[i]:
# 		start_end.append(i)
# 		flag = 1
# 	if flag == 1 and not state[i]:
# 		start_end.append(i-1)
# 		flag = 0
# 	if i == 2400 and flag == 1:
# 		start_end.append(2400)
# #print(start_end)
# for _ in range(int(len(start_end)/2)):
# 	print("{}-{}".format(str(start_end.pop(0)).zfill(4), str(start_end.pop(0)).zfill(4)))

start, end = None, None
for before, after in sorted(SE):
	bf = int(rounded_time_before(before))
	af = int(rounded_time_after(after))
	if not start and not end:
		start, end = bf, af
	if bf > end: # 次の降雨時間
		print("{}-{}".format(str(start).zfill(4), str(end).zfill(4)))
		start, end = bf, af
	else:
		if af > end:
			end = af
print("{}-{}".format(str(start).zfill(4), str(end).zfill(4)))

Submission Info

Submission Time
Task D - 感雨時刻の整理
User tonnnura172
Language Python (3.4.3)
Score 100
Code Size 2005 Byte
Status AC
Exec Time 234 ms
Memory 10676 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 48
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 18 ms 3064 KB
00_sample_02.txt AC 18 ms 3064 KB
00_sample_03.txt AC 18 ms 3064 KB
cho_cho_chokudai.txt AC 207 ms 9652 KB
chokudai_ga_cho.txt AC 192 ms 10292 KB
test_01.txt AC 20 ms 3064 KB
test_02.txt AC 20 ms 3064 KB
test_03.txt AC 20 ms 3064 KB
test_04.txt AC 20 ms 3064 KB
test_05.txt AC 20 ms 3064 KB
test_06.txt AC 20 ms 3064 KB
test_07.txt AC 19 ms 3064 KB
test_08.txt AC 19 ms 3064 KB
test_09.txt AC 22 ms 3188 KB
test_10.txt AC 22 ms 3188 KB
test_11.txt AC 21 ms 3188 KB
test_12.txt AC 21 ms 3064 KB
test_13.txt AC 20 ms 3064 KB
test_14.txt AC 22 ms 3188 KB
test_15.txt AC 23 ms 3188 KB
test_16.txt AC 20 ms 3064 KB
test_17.txt AC 22 ms 3064 KB
test_18.txt AC 20 ms 3064 KB
test_19.txt AC 21 ms 3064 KB
test_20.txt AC 21 ms 3064 KB
test_21.txt AC 228 ms 10476 KB
test_22.txt AC 223 ms 10600 KB
test_23.txt AC 228 ms 10552 KB
test_24.txt AC 233 ms 10676 KB
test_25.txt AC 222 ms 10608 KB
test_26.txt AC 219 ms 10372 KB
test_27.txt AC 206 ms 10612 KB
test_28.txt AC 218 ms 10484 KB
test_29.txt AC 18 ms 3064 KB
test_30.txt AC 18 ms 3064 KB
test_31.txt AC 47 ms 4084 KB
test_32.txt AC 18 ms 3064 KB
test_33.txt AC 146 ms 7820 KB
test_34.txt AC 18 ms 3064 KB
test_35.txt AC 20 ms 3064 KB
test_36.txt AC 234 ms 10612 KB
test_37.txt AC 216 ms 10388 KB
test_38.txt AC 218 ms 10356 KB
test_39.txt AC 216 ms 10612 KB
test_40.txt AC 213 ms 10280 KB
test_41.txt AC 195 ms 10340 KB
test_42.txt AC 214 ms 10352 KB
test_43.txt AC 197 ms 10400 KB