Submission #7571597
Source Code Expand
from itertools import combinations def main(): n = int(input()) se_input = [] for _ in range(n): se_input.append(input()) se_input_ls = [se.split("-") for se in se_input] # round to five rounded_se_ls = [] for s, e in se_input_ls: s = int(s) e = int(e) s_fd = s % 10 e_fd = e % 10 if s_fd < 5: s = s - s_fd else: s = s - s_fd + 5 if e_fd != 0: if e_fd < 5: e = e - e_fd + 5 else: e = e - e_fd + 10 rounded_se_ls.append([s, e]) # remove duplicates se_ls = [se.split("-") for se in sorted(list(set([str(s)+"-"+str(e) for s, e in rounded_se_ls])))] # combine flg = True while flg: flg = False for i1, i2 in combinations(range(len(se_ls)), 2): b, new_se = shall_we_combine(se_ls[i1], se_ls[i2]) if b: se_ls.pop(i2) se_ls.pop(i1) se_ls.append(new_se) se_ls = sorted(se_ls) flg = True break # print result for s, e in se_ls: print(str(s).zfill(4) + "-" + str(e).zfill(4)) def shall_we_combine(se1, se2): if max(se1[0], se2[0]) <= min(se1[1], se2[1]): return True, [min(se1[0], se2[0]), max(se1[1], se2[1])] else: return False, None if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | phorizon20 |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1513 Byte |
Status | WA |
Exec Time | 2105 ms |
Memory | 27368 KB |
Judge Result
Set Name | all | ||||||
---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 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 | 20 ms | 3188 KB |
00_sample_02.txt | AC | 18 ms | 3188 KB |
00_sample_03.txt | AC | 18 ms | 3188 KB |
cho_cho_chokudai.txt | WA | 109 ms | 19884 KB |
chokudai_ga_cho.txt | TLE | 2105 ms | 27368 KB |
test_01.txt | WA | 20 ms | 3188 KB |
test_02.txt | WA | 20 ms | 3188 KB |
test_03.txt | WA | 21 ms | 3188 KB |
test_04.txt | WA | 20 ms | 3188 KB |
test_05.txt | WA | 20 ms | 3188 KB |
test_06.txt | WA | 23 ms | 3188 KB |
test_07.txt | WA | 21 ms | 3188 KB |
test_08.txt | WA | 21 ms | 3188 KB |
test_09.txt | WA | 21 ms | 3436 KB |
test_10.txt | WA | 22 ms | 3444 KB |
test_11.txt | WA | 20 ms | 3316 KB |
test_12.txt | WA | 24 ms | 3316 KB |
test_13.txt | WA | 22 ms | 3188 KB |
test_14.txt | WA | 38 ms | 3444 KB |
test_15.txt | WA | 30 ms | 3444 KB |
test_16.txt | WA | 21 ms | 3188 KB |
test_17.txt | WA | 37 ms | 3564 KB |
test_18.txt | WA | 22 ms | 3188 KB |
test_19.txt | WA | 30 ms | 3444 KB |
test_20.txt | WA | 31 ms | 3444 KB |
test_21.txt | TLE | 2105 ms | 22552 KB |
test_22.txt | TLE | 2105 ms | 24744 KB |
test_23.txt | TLE | 2105 ms | 23404 KB |
test_24.txt | TLE | 2105 ms | 24768 KB |
test_25.txt | TLE | 2105 ms | 24388 KB |
test_26.txt | WA | 134 ms | 20728 KB |
test_27.txt | AC | 116 ms | 20860 KB |
test_28.txt | WA | 886 ms | 20904 KB |
test_29.txt | AC | 18 ms | 3064 KB |
test_30.txt | WA | 21 ms | 3188 KB |
test_31.txt | WA | 44 ms | 5732 KB |
test_32.txt | WA | 20 ms | 3188 KB |
test_33.txt | WA | 97 ms | 14672 KB |
test_34.txt | WA | 18 ms | 3188 KB |
test_35.txt | WA | 31 ms | 3188 KB |
test_36.txt | TLE | 2105 ms | 25736 KB |
test_37.txt | WA | 135 ms | 20720 KB |
test_38.txt | WA | 127 ms | 20788 KB |
test_39.txt | TLE | 2105 ms | 21056 KB |
test_40.txt | WA | 308 ms | 20760 KB |
test_41.txt | WA | 117 ms | 20792 KB |
test_42.txt | WA | 117 ms | 20900 KB |
test_43.txt | WA | 120 ms | 20868 KB |