Submission #522517
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; int s = Integer.parseInt(l.split("-")[0]); starts.put(s, i); } Object[] key = starts.keySet().toArray(); Arrays.sort(key); int index = 0; BigDecimal bds; BigDecimal bde; BigDecimal bdls = BigDecimal.valueOf(0); BigDecimal bdle = BigDecimal.valueOf(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 = new BigDecimal(tmp[0]); BigDecimal s = bds.divide(BigDecimal.TEN, BigDecimal.ROUND_FLOOR); if (bds.remainder(BigDecimal.TEN).intValue() >= 5) { bds = s.multiply(BigDecimal.TEN).add(BigDecimal.valueOf(5)); } else { bds = s.multiply(BigDecimal.TEN); } if (bds.remainder(BigDecimal.valueOf(100)).intValue() > 59) { bds = bds.add(BigDecimal.valueOf(40)); } bde = new BigDecimal(tmp[1]); BigDecimal e = bde.divide(BigDecimal.TEN, BigDecimal.ROUND_FLOOR); if (bde.remainder(BigDecimal.TEN).intValue() > 5) { bde = e.multiply(BigDecimal.TEN).add(BigDecimal.valueOf(10)); } else if (bde.remainder(BigDecimal.TEN).intValue() >= 1) { bde = e.multiply(BigDecimal.TEN).add(BigDecimal.valueOf(5)); } else { bde = e.multiply(BigDecimal.TEN); } if (bde.remainder(BigDecimal.valueOf(100)).intValue() > 59) { bde = bde.add(BigDecimal.valueOf(40)); } if (bde.intValue() > 2359) { bde = BigDecimal.valueOf(2400); } if (i > 0) { if (bds.compareTo(bdls) <= 0) { if (0 <= bde.compareTo(bdle)) { out[index - 1] = String.format("%04d-%04d", bds.intValue(), bde.intValue()); bdls = bds; bdle = bde; } else { out[index - 1] = String.format("%04d-%04d", bds.intValue(), bdle.intValue()); bdls = bds; } continue; } else if (bds.compareTo(bdle) <= 0 && 0 <= bde.compareTo(bdle)) { out[index-1] = String.format("%04d-%04d", bdls.intValue(), bde.intValue()); bdle = bde; continue; } else if (bde.compareTo(bdle) <= 0) { continue; } } out[index] = String.format("%04d-%04d", bds.intValue(), bde.intValue()); 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 | 0 |
Code Size | 3535 Byte |
Status | WA |
Exec Time | 1327 ms |
Memory | 47640 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 | 404 ms | 24324 KB |
00_sample_02.txt | AC | 396 ms | 24220 KB |
00_sample_03.txt | AC | 399 ms | 24376 KB |
cho_cho_chokudai.txt | AC | 876 ms | 40788 KB |
chokudai_ga_cho.txt | AC | 1245 ms | 44800 KB |
test_01.txt | AC | 536 ms | 27648 KB |
test_02.txt | AC | 540 ms | 27708 KB |
test_03.txt | AC | 541 ms | 27636 KB |
test_04.txt | AC | 545 ms | 27700 KB |
test_05.txt | AC | 557 ms | 27608 KB |
test_06.txt | AC | 613 ms | 32272 KB |
test_07.txt | AC | 561 ms | 28208 KB |
test_08.txt | AC | 511 ms | 26396 KB |
test_09.txt | AC | 486 ms | 26408 KB |
test_10.txt | AC | 528 ms | 28656 KB |
test_11.txt | AC | 465 ms | 25256 KB |
test_12.txt | AC | 721 ms | 36236 KB |
test_13.txt | AC | 592 ms | 30080 KB |
test_14.txt | AC | 784 ms | 36848 KB |
test_15.txt | AC | 771 ms | 37504 KB |
test_16.txt | AC | 554 ms | 27864 KB |
test_17.txt | AC | 708 ms | 36232 KB |
test_18.txt | AC | 556 ms | 29104 KB |
test_19.txt | AC | 630 ms | 34728 KB |
test_20.txt | AC | 666 ms | 35524 KB |
test_21.txt | AC | 1241 ms | 44844 KB |
test_22.txt | AC | 1228 ms | 44860 KB |
test_23.txt | AC | 1255 ms | 44680 KB |
test_24.txt | AC | 1199 ms | 44304 KB |
test_25.txt | AC | 1250 ms | 44844 KB |
test_26.txt | AC | 1200 ms | 44528 KB |
test_27.txt | AC | 889 ms | 41812 KB |
test_28.txt | AC | 1159 ms | 43816 KB |
test_29.txt | AC | 405 ms | 24236 KB |
test_30.txt | AC | 444 ms | 25016 KB |
test_31.txt | WA | 926 ms | 37776 KB |
test_32.txt | WA | 427 ms | 24768 KB |
test_33.txt | AC | 1327 ms | 47640 KB |
test_34.txt | AC | 447 ms | 24332 KB |
test_35.txt | WA | 526 ms | 26888 KB |
test_36.txt | AC | 1161 ms | 44460 KB |
test_37.txt | AC | 1182 ms | 44476 KB |
test_38.txt | AC | 1270 ms | 45564 KB |
test_39.txt | AC | 1133 ms | 43968 KB |
test_40.txt | AC | 1238 ms | 43756 KB |
test_41.txt | AC | 1032 ms | 41720 KB |
test_42.txt | AC | 1146 ms | 42244 KB |
test_43.txt | AC | 970 ms | 41776 KB |