Submission #1035485
Source Code Expand
import datetime def roll(tm_string, roll_back=True): if tm_string == "2400": tm = datetime.datetime(1900, 1, 2) else: tm = datetime.datetime.strptime(tm_string, '%H%M') odd = int(tm.minute) % 5 if odd != 0: if roll_back: tm -= datetime.timedelta(minutes=odd) else: tm += datetime.timedelta(minutes=(5 - odd)) return tm N = int(input()) Start = list() End = list() for x in range(N): mem_string = input() mem_time = mem_string.split("-") Start.append(roll(mem_time[0])) End.append(roll(mem_time[1], roll_back=False)) Start.sort() End.sort() Start_arranged = [Start[0]] End_arranged = list() for x in range(len(Start)-1): if Start[x+1] > End[x]: Start_arranged.append(Start[x+1]) End_arranged.append(End[x]) End_arranged.append(End[-1]) for x in range(len(Start_arranged)): Ans_S = Start_arranged[x].strftime('%H%M') Ans_E = End_arranged[x].strftime('%H%M') if End_arranged[x].day == 2: Ans_E = "2400" print("{0}-{1}".format(Ans_S, Ans_E))
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | AokabiC |
Language | Python (3.2.3) |
Score | 100 |
Code Size | 1154 Byte |
Status | AC |
Exec Time | 1364 ms |
Memory | 12480 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
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 | 123 ms | 8516 KB |
00_sample_02.txt | AC | 91 ms | 8476 KB |
00_sample_03.txt | AC | 92 ms | 8472 KB |
cho_cho_chokudai.txt | AC | 1307 ms | 11500 KB |
chokudai_ga_cho.txt | AC | 1283 ms | 11456 KB |
test_01.txt | AC | 96 ms | 8476 KB |
test_02.txt | AC | 96 ms | 8532 KB |
test_03.txt | AC | 99 ms | 8476 KB |
test_04.txt | AC | 97 ms | 8444 KB |
test_05.txt | AC | 96 ms | 8524 KB |
test_06.txt | AC | 97 ms | 8596 KB |
test_07.txt | AC | 97 ms | 8476 KB |
test_08.txt | AC | 100 ms | 8524 KB |
test_09.txt | AC | 119 ms | 8528 KB |
test_10.txt | AC | 116 ms | 8560 KB |
test_11.txt | AC | 113 ms | 8524 KB |
test_12.txt | AC | 104 ms | 8528 KB |
test_13.txt | AC | 105 ms | 8476 KB |
test_14.txt | AC | 109 ms | 8528 KB |
test_15.txt | AC | 111 ms | 8528 KB |
test_16.txt | AC | 99 ms | 8448 KB |
test_17.txt | AC | 115 ms | 8476 KB |
test_18.txt | AC | 103 ms | 8528 KB |
test_19.txt | AC | 109 ms | 8532 KB |
test_20.txt | AC | 109 ms | 8528 KB |
test_21.txt | AC | 1306 ms | 11528 KB |
test_22.txt | AC | 1305 ms | 11528 KB |
test_23.txt | AC | 1313 ms | 11516 KB |
test_24.txt | AC | 1269 ms | 11576 KB |
test_25.txt | AC | 1276 ms | 11580 KB |
test_26.txt | AC | 1305 ms | 11436 KB |
test_27.txt | AC | 1291 ms | 11396 KB |
test_28.txt | AC | 1273 ms | 11496 KB |
test_29.txt | AC | 93 ms | 8472 KB |
test_30.txt | AC | 93 ms | 8444 KB |
test_31.txt | AC | 275 ms | 9036 KB |
test_32.txt | AC | 94 ms | 8440 KB |
test_33.txt | AC | 871 ms | 10552 KB |
test_34.txt | AC | 90 ms | 8476 KB |
test_35.txt | AC | 103 ms | 8528 KB |
test_36.txt | AC | 1364 ms | 11532 KB |
test_37.txt | AC | 1295 ms | 11532 KB |
test_38.txt | AC | 1289 ms | 11520 KB |
test_39.txt | AC | 1298 ms | 11528 KB |
test_40.txt | AC | 1287 ms | 11492 KB |
test_41.txt | AC | 1183 ms | 12432 KB |
test_42.txt | AC | 1196 ms | 12428 KB |
test_43.txt | AC | 1175 ms | 12480 KB |