Submission #3580842
Source Code Expand
from datetime import datetime, timedelta def parse_input(): line = input() N = int(line) lines = list() for _ in range(N): line = input() elements = line.split(' ') d1 = datetime.strptime(elements[0], '%H:%M:%S.%f') d2 = datetime.strptime(elements[1], '%H:%M:%S.%f') lines.append([d1, d2]) return N, lines def main(): delta_millisec = 1000 N, lines = parse_input() ### find reverse case reverse_cases = list() reverse_time_from = None reverse_time_to = None for i, line in enumerate(lines): if line[0] >= line[1]: reverse_cases.append(i) if reverse_time_from is None or line[0] > reverse_time_from: reverse_time_from = line[0] if reverse_time_to is None or line[1] + timedelta(milliseconds=delta_millisec) < reverse_time_to: reverse_time_to = line[1] + timedelta(milliseconds=delta_millisec) ### case 1 if len(reverse_cases) == 0: for _ in lines: print(-1) return ### case 2 # It is unknown whether the time is true or not. unknown_time_from = reverse_time_from - timedelta(milliseconds=delta_millisec) unknown_time_to = reverse_time_to for i, line in enumerate(lines): if i in reverse_cases: print(int((reverse_time_to - reverse_time_from).total_seconds() * 1000)) continue time_from = line[0] time_to = line[1] if (time_to <= unknown_time_from) or (unknown_time_to <= time_from): print(int((time_to - time_from).total_seconds() * 1000)) elif time_from <= unknown_time_from and unknown_time_to <= time_to: print(int((time_to - time_from + timedelta(milliseconds=delta_millisec)).total_seconds() * 1000)) else: print(-1) if __name__=='__main__': main()
Submission Info
Submission Time | |
---|---|
Task | B - stepモード |
User | marugeso530 |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1974 Byte |
Status | WA |
Exec Time | 35 ms |
Memory | 4720 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 50 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_corner100.txt, 00_corner101.txt, 00_corner102.txt, 00_corner103.txt, 00_corner104.txt, 00_corner105.txt, 00_corner106.txt, 00_corner107.txt, 00_corner108.txt, 00_corner109.txt, 00_corner110.txt, 00_corner111.txt, 00_corner112.txt, 00_corner113.txt, 00_corner114.txt, 00_corner115.txt, 00_corner116.txt, 00_corner117.txt, 00_corner118.txt, 00_corner119.txt, 00_corner120.txt, 00_corner121.txt, 00_corner122.txt, 00_corner123.txt, 00_example_1.txt, 00_example_2.txt, 00_example_3.txt, 00_example_4.txt, 00_manual_001.txt, 00_manual_002.txt, 00_manual_003.txt, 00_manual_004.txt, 00_manual_005.txt, 00_small_009.txt, 00_small_010.txt, 00_small_011.txt, 00_small_012.txt, 00_small_013.txt, 00_small_014.txt, 00_small_015.txt, 00_small_016.txt, 00_small_017.txt, 00_small_018.txt, 00_small_019.txt, 00_small_020.txt, 01_random_100.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_24.txt, 01_random_25.txt, 01_random_27.txt, 01_random_29.txt, 01_random_31.txt, 01_random_34.txt, 01_random_37.txt, 01_random_39.txt, 01_random_4.txt, 01_random_41.txt, 01_random_43.txt, 01_random_45.txt, 01_random_46.txt, 01_random_47.txt, 01_random_48.txt, 01_random_5.txt, 01_random_50.txt, 01_random_51.txt, 01_random_52.txt, 01_random_54.txt, 01_random_56.txt, 01_random_57.txt, 01_random_58.txt, 01_random_59.txt, 01_random_6.txt, 01_random_60.txt, 01_random_62.txt, 01_random_65.txt, 01_random_66.txt, 01_random_68.txt, 01_random_69.txt, 01_random_7.txt, 01_random_70.txt, 01_random_72.txt, 01_random_75.txt, 01_random_76.txt, 01_random_77.txt, 01_random_79.txt, 01_random_8.txt, 01_random_80.txt, 01_random_81.txt, 01_random_82.txt, 01_random_83.txt, 01_random_84.txt, 01_random_85.txt, 01_random_87.txt, 01_random_89.txt, 01_random_9.txt, 01_random_91.txt, 01_random_92.txt, 01_random_93.txt, 01_random_94.txt, 01_random_95.txt, 01_random_96.txt, 01_random_97.txt, 01_random_98.txt, 01_random_99.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_corner100.txt | AC | 31 ms | 4328 KB |
00_corner101.txt | WA | 30 ms | 4336 KB |
00_corner102.txt | AC | 30 ms | 4328 KB |
00_corner103.txt | AC | 30 ms | 4328 KB |
00_corner104.txt | WA | 30 ms | 4328 KB |
00_corner105.txt | WA | 31 ms | 4328 KB |
00_corner106.txt | AC | 30 ms | 4328 KB |
00_corner107.txt | AC | 30 ms | 4328 KB |
00_corner108.txt | AC | 30 ms | 4328 KB |
00_corner109.txt | AC | 30 ms | 4328 KB |
00_corner110.txt | AC | 30 ms | 4328 KB |
00_corner111.txt | AC | 30 ms | 4328 KB |
00_corner112.txt | WA | 30 ms | 4328 KB |
00_corner113.txt | AC | 30 ms | 4328 KB |
00_corner114.txt | AC | 30 ms | 4328 KB |
00_corner115.txt | WA | 30 ms | 4328 KB |
00_corner116.txt | WA | 30 ms | 4328 KB |
00_corner117.txt | AC | 30 ms | 4328 KB |
00_corner118.txt | AC | 30 ms | 4328 KB |
00_corner119.txt | AC | 30 ms | 4328 KB |
00_corner120.txt | AC | 30 ms | 4328 KB |
00_corner121.txt | AC | 30 ms | 4328 KB |
00_corner122.txt | AC | 30 ms | 4328 KB |
00_corner123.txt | WA | 30 ms | 4328 KB |
00_example_1.txt | AC | 30 ms | 4336 KB |
00_example_2.txt | AC | 31 ms | 4720 KB |
00_example_3.txt | AC | 30 ms | 4336 KB |
00_example_4.txt | AC | 30 ms | 4336 KB |
00_manual_001.txt | AC | 30 ms | 4336 KB |
00_manual_002.txt | AC | 30 ms | 4336 KB |
00_manual_003.txt | AC | 30 ms | 4336 KB |
00_manual_004.txt | AC | 30 ms | 4336 KB |
00_manual_005.txt | AC | 30 ms | 4336 KB |
00_small_009.txt | AC | 30 ms | 4336 KB |
00_small_010.txt | AC | 30 ms | 4336 KB |
00_small_011.txt | AC | 30 ms | 4336 KB |
00_small_012.txt | AC | 30 ms | 4336 KB |
00_small_013.txt | AC | 30 ms | 4336 KB |
00_small_014.txt | AC | 30 ms | 4336 KB |
00_small_015.txt | AC | 30 ms | 4336 KB |
00_small_016.txt | AC | 30 ms | 4336 KB |
00_small_017.txt | AC | 30 ms | 4336 KB |
00_small_018.txt | AC | 30 ms | 4336 KB |
00_small_019.txt | AC | 30 ms | 4720 KB |
00_small_020.txt | AC | 30 ms | 4336 KB |
01_random_100.txt | WA | 33 ms | 4336 KB |
01_random_11.txt | AC | 30 ms | 4336 KB |
01_random_12.txt | WA | 30 ms | 4336 KB |
01_random_13.txt | AC | 30 ms | 4336 KB |
01_random_14.txt | AC | 30 ms | 4336 KB |
01_random_16.txt | AC | 30 ms | 4336 KB |
01_random_17.txt | AC | 30 ms | 4336 KB |
01_random_18.txt | WA | 30 ms | 4336 KB |
01_random_19.txt | WA | 30 ms | 4336 KB |
01_random_20.txt | WA | 32 ms | 4336 KB |
01_random_21.txt | AC | 30 ms | 4336 KB |
01_random_24.txt | WA | 31 ms | 4336 KB |
01_random_25.txt | WA | 30 ms | 4336 KB |
01_random_27.txt | AC | 31 ms | 4336 KB |
01_random_29.txt | AC | 31 ms | 4336 KB |
01_random_31.txt | AC | 31 ms | 4336 KB |
01_random_34.txt | AC | 31 ms | 4336 KB |
01_random_37.txt | WA | 31 ms | 4336 KB |
01_random_39.txt | WA | 31 ms | 4336 KB |
01_random_4.txt | AC | 30 ms | 4336 KB |
01_random_41.txt | WA | 31 ms | 4336 KB |
01_random_43.txt | WA | 31 ms | 4336 KB |
01_random_45.txt | WA | 31 ms | 4336 KB |
01_random_46.txt | AC | 31 ms | 4336 KB |
01_random_47.txt | WA | 31 ms | 4336 KB |
01_random_48.txt | WA | 31 ms | 4336 KB |
01_random_5.txt | AC | 30 ms | 4336 KB |
01_random_50.txt | WA | 31 ms | 4336 KB |
01_random_51.txt | AC | 31 ms | 4336 KB |
01_random_52.txt | WA | 32 ms | 4336 KB |
01_random_54.txt | AC | 32 ms | 4336 KB |
01_random_56.txt | WA | 32 ms | 4336 KB |
01_random_57.txt | AC | 31 ms | 4336 KB |
01_random_58.txt | WA | 32 ms | 4336 KB |
01_random_59.txt | WA | 32 ms | 4336 KB |
01_random_6.txt | AC | 30 ms | 4336 KB |
01_random_60.txt | WA | 32 ms | 4336 KB |
01_random_62.txt | WA | 32 ms | 4336 KB |
01_random_65.txt | WA | 32 ms | 4336 KB |
01_random_66.txt | AC | 32 ms | 4336 KB |
01_random_68.txt | WA | 32 ms | 4336 KB |
01_random_69.txt | WA | 32 ms | 4336 KB |
01_random_7.txt | AC | 30 ms | 4336 KB |
01_random_70.txt | AC | 32 ms | 4336 KB |
01_random_72.txt | WA | 32 ms | 4336 KB |
01_random_75.txt | WA | 32 ms | 4336 KB |
01_random_76.txt | WA | 32 ms | 4336 KB |
01_random_77.txt | WA | 33 ms | 4336 KB |
01_random_79.txt | WA | 33 ms | 4336 KB |
01_random_8.txt | WA | 30 ms | 4336 KB |
01_random_80.txt | WA | 32 ms | 4336 KB |
01_random_81.txt | WA | 32 ms | 4336 KB |
01_random_82.txt | WA | 33 ms | 4336 KB |
01_random_83.txt | WA | 33 ms | 4336 KB |
01_random_84.txt | WA | 33 ms | 4336 KB |
01_random_85.txt | AC | 33 ms | 4336 KB |
01_random_87.txt | AC | 33 ms | 4336 KB |
01_random_89.txt | WA | 33 ms | 4336 KB |
01_random_9.txt | AC | 30 ms | 4336 KB |
01_random_91.txt | WA | 33 ms | 4336 KB |
01_random_92.txt | WA | 33 ms | 4336 KB |
01_random_93.txt | WA | 35 ms | 4336 KB |
01_random_94.txt | AC | 33 ms | 4336 KB |
01_random_95.txt | WA | 33 ms | 4336 KB |
01_random_96.txt | WA | 33 ms | 4336 KB |
01_random_97.txt | WA | 33 ms | 4336 KB |
01_random_98.txt | AC | 33 ms | 4336 KB |
01_random_99.txt | WA | 33 ms | 4336 KB |