Submission #4797152
Source Code Expand
from sys import stdin from decimal import Decimal, ROUND_HALF_UP """ def rounded_time_before(time): # 前の時間用 tmp = 10 * Decimal(str(time*0.1)).quantize(Decimal('0'), rounding=ROUND_HALF_UP) if time < float(tmp): tmp -= 5 return tmp def rounded_time_after(time): # 後の時間用 if str(time)[-1] == "5": time -= 1 tmp = 10 * Decimal(str(time*0.1)).quantize(Decimal('0'), rounding=ROUND_HALF_UP) 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 #print(SE) """ 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)) bf = before af = 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 | 2055 Byte |
Status | AC |
Exec Time | 157 ms |
Memory | 12580 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 | 35 ms | 5076 KB |
00_sample_02.txt | AC | 35 ms | 5076 KB |
00_sample_03.txt | AC | 35 ms | 5076 KB |
cho_cho_chokudai.txt | AC | 141 ms | 11548 KB |
chokudai_ga_cho.txt | AC | 135 ms | 12364 KB |
test_01.txt | AC | 35 ms | 5076 KB |
test_02.txt | AC | 35 ms | 5076 KB |
test_03.txt | AC | 35 ms | 5076 KB |
test_04.txt | AC | 35 ms | 5076 KB |
test_05.txt | AC | 35 ms | 5076 KB |
test_06.txt | AC | 35 ms | 5076 KB |
test_07.txt | AC | 35 ms | 5076 KB |
test_08.txt | AC | 35 ms | 5076 KB |
test_09.txt | AC | 37 ms | 5076 KB |
test_10.txt | AC | 37 ms | 5076 KB |
test_11.txt | AC | 37 ms | 5076 KB |
test_12.txt | AC | 37 ms | 5076 KB |
test_13.txt | AC | 36 ms | 5076 KB |
test_14.txt | AC | 37 ms | 5076 KB |
test_15.txt | AC | 37 ms | 5076 KB |
test_16.txt | AC | 36 ms | 5076 KB |
test_17.txt | AC | 37 ms | 5076 KB |
test_18.txt | AC | 36 ms | 5076 KB |
test_19.txt | AC | 36 ms | 5076 KB |
test_20.txt | AC | 36 ms | 5076 KB |
test_21.txt | AC | 155 ms | 12420 KB |
test_22.txt | AC | 155 ms | 12580 KB |
test_23.txt | AC | 157 ms | 12436 KB |
test_24.txt | AC | 153 ms | 12576 KB |
test_25.txt | AC | 153 ms | 12564 KB |
test_26.txt | AC | 151 ms | 12340 KB |
test_27.txt | AC | 131 ms | 12500 KB |
test_28.txt | AC | 150 ms | 12428 KB |
test_29.txt | AC | 35 ms | 5076 KB |
test_30.txt | AC | 35 ms | 5076 KB |
test_31.txt | AC | 51 ms | 5964 KB |
test_32.txt | AC | 36 ms | 5076 KB |
test_33.txt | AC | 109 ms | 9764 KB |
test_34.txt | AC | 35 ms | 5076 KB |
test_35.txt | AC | 36 ms | 5076 KB |
test_36.txt | AC | 157 ms | 12500 KB |
test_37.txt | AC | 143 ms | 12296 KB |
test_38.txt | AC | 152 ms | 12308 KB |
test_39.txt | AC | 148 ms | 12500 KB |
test_40.txt | AC | 145 ms | 12312 KB |
test_41.txt | AC | 119 ms | 12364 KB |
test_42.txt | AC | 138 ms | 12316 KB |
test_43.txt | AC | 117 ms | 12356 KB |