Submission #522541
Source Code Expand
import java.math.BigDecimal; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] argv) { Scanner scanner = new Scanner(System.in); int time = scanner.nextInt(); String[] lines = new String[time]; HashMap<Integer, Integer> starts = new HashMap<Integer, Integer>(); for (int i = 0; i < time; i++) { String l = scanner.next(); lines[i] = l; String[] t = l.split("-"); int s = Integer.parseInt(t[0] + t[1]); starts.put(s, i); } Object[] key = starts.keySet().toArray(); Arrays.sort(key); int index = 0; int bds; int bde; int bdls = 0; int bdle = 0; String[] out = new String[time]; for (int i = 0; i < key.length; i++) { int k = starts.get(key[i]); String[] tmp = lines[k].split("-"); bds = Integer.parseInt(tmp[0]); double s = Math.floor(bds / 10); if (bds % 10 >= 5) { bds = (int)s * 10 + 5; } else { bds = (int)s * 10; } if (bds % 100 > 59) { bds = bds + 40; } bde = Integer.parseInt(tmp[1]); double e = Math.floor(bde / 10); if (bde % 10 > 5) { bde = (int)e * 10 + 10; } else if (bde % 10 >= 1) { bde = (int)e * 10 + 5; } else { bde = (int)e * 10; } if (bde % 100 > 59) { bde = bde + 40; } if (bde > 2359) { bde = 2400; } if (i > 0) { if (bds <= bdls) { if (bdle <= bde) { out[index - 1] = String.format("%04d-%04d", bds, bde); bdls = bds; bdle = bde; } else { out[index - 1] = String.format("%04d-%04d", bds, bdle); bdls = bds; } continue; } else if (bds <= bdle && bdle <= bde) { out[index - 1] = String.format("%04d-%04d", bdls, bde); bdle = bde; continue; } else if (bde <= bdle) { continue; } } out[index] = String.format("%04d-%04d", bds, bde); bdls = bds; bdle = bde; index++; } for (int i = 0; i < out.length; i++) { if (out[i] == null) { break; } System.out.println(out[i]); } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | delaemon |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 2893 Byte |
Status | AC |
Exec Time | 1374 ms |
Memory | 45244 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 | 498 ms | 23792 KB |
00_sample_02.txt | AC | 498 ms | 23820 KB |
00_sample_03.txt | AC | 494 ms | 23816 KB |
cho_cho_chokudai.txt | AC | 1033 ms | 42604 KB |
chokudai_ga_cho.txt | AC | 1247 ms | 44360 KB |
test_01.txt | AC | 551 ms | 24360 KB |
test_02.txt | AC | 534 ms | 24288 KB |
test_03.txt | AC | 542 ms | 24424 KB |
test_04.txt | AC | 542 ms | 24428 KB |
test_05.txt | AC | 541 ms | 24444 KB |
test_06.txt | AC | 556 ms | 25160 KB |
test_07.txt | AC | 557 ms | 24504 KB |
test_08.txt | AC | 541 ms | 24272 KB |
test_09.txt | AC | 579 ms | 26016 KB |
test_10.txt | AC | 581 ms | 26040 KB |
test_11.txt | AC | 567 ms | 24804 KB |
test_12.txt | AC | 637 ms | 25700 KB |
test_13.txt | AC | 565 ms | 24696 KB |
test_14.txt | AC | 692 ms | 28436 KB |
test_15.txt | AC | 677 ms | 30860 KB |
test_16.txt | AC | 541 ms | 24136 KB |
test_17.txt | AC | 597 ms | 26132 KB |
test_18.txt | AC | 542 ms | 24288 KB |
test_19.txt | AC | 545 ms | 25164 KB |
test_20.txt | AC | 583 ms | 25308 KB |
test_21.txt | AC | 1329 ms | 45240 KB |
test_22.txt | AC | 1311 ms | 44520 KB |
test_23.txt | AC | 1290 ms | 45244 KB |
test_24.txt | AC | 1300 ms | 44748 KB |
test_25.txt | AC | 1278 ms | 45024 KB |
test_26.txt | AC | 1119 ms | 42208 KB |
test_27.txt | AC | 1025 ms | 42008 KB |
test_28.txt | AC | 1374 ms | 45224 KB |
test_29.txt | AC | 501 ms | 23792 KB |
test_30.txt | AC | 519 ms | 24044 KB |
test_31.txt | AC | 923 ms | 34036 KB |
test_32.txt | AC | 511 ms | 24048 KB |
test_33.txt | AC | 1290 ms | 43092 KB |
test_34.txt | AC | 509 ms | 23912 KB |
test_35.txt | AC | 568 ms | 25052 KB |
test_36.txt | AC | 1259 ms | 44852 KB |
test_37.txt | AC | 1355 ms | 45052 KB |
test_38.txt | AC | 1161 ms | 43732 KB |
test_39.txt | AC | 1316 ms | 43372 KB |
test_40.txt | AC | 1332 ms | 43176 KB |
test_41.txt | AC | 1012 ms | 42172 KB |
test_42.txt | AC | 1043 ms | 42392 KB |
test_43.txt | AC | 1022 ms | 42380 KB |