Submission #522534
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(String.format("%04d%04d", Integer.parseInt(t[0]), Integer.parseInt(t[1]))); 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 | 3685 Byte |
Status | TLE |
Exec Time | 2088 ms |
Memory | 52648 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 | 535 ms | 24296 KB |
00_sample_02.txt | AC | 512 ms | 24404 KB |
00_sample_03.txt | AC | 513 ms | 24540 KB |
cho_cho_chokudai.txt | AC | 1581 ms | 48200 KB |
chokudai_ga_cho.txt | TLE | 2078 ms | 52648 KB |
test_01.txt | AC | 679 ms | 27984 KB |
test_02.txt | AC | 679 ms | 27952 KB |
test_03.txt | AC | 684 ms | 27956 KB |
test_04.txt | AC | 678 ms | 27936 KB |
test_05.txt | AC | 672 ms | 28008 KB |
test_06.txt | AC | 773 ms | 32412 KB |
test_07.txt | AC | 720 ms | 28500 KB |
test_08.txt | AC | 661 ms | 26788 KB |
test_09.txt | AC | 698 ms | 30040 KB |
test_10.txt | AC | 737 ms | 30972 KB |
test_11.txt | AC | 669 ms | 29972 KB |
test_12.txt | AC | 876 ms | 36940 KB |
test_13.txt | AC | 727 ms | 31140 KB |
test_14.txt | AC | 924 ms | 36920 KB |
test_15.txt | AC | 925 ms | 37372 KB |
test_16.txt | AC | 696 ms | 29292 KB |
test_17.txt | AC | 881 ms | 36824 KB |
test_18.txt | AC | 720 ms | 30452 KB |
test_19.txt | AC | 843 ms | 35852 KB |
test_20.txt | AC | 875 ms | 36556 KB |
test_21.txt | TLE | 2069 ms | 51696 KB |
test_22.txt | TLE | 2075 ms | 52332 KB |
test_23.txt | TLE | 2088 ms | 52072 KB |
test_24.txt | TLE | 2070 ms | 52272 KB |
test_25.txt | TLE | 2071 ms | 51376 KB |
test_26.txt | AC | 1778 ms | 48372 KB |
test_27.txt | AC | 1544 ms | 47816 KB |
test_28.txt | TLE | 2066 ms | 49352 KB |
test_29.txt | AC | 513 ms | 24392 KB |
test_30.txt | AC | 566 ms | 25320 KB |
test_31.txt | AC | 1554 ms | 46312 KB |
test_32.txt | AC | 555 ms | 25152 KB |
test_33.txt | AC | 1935 ms | 49128 KB |
test_34.txt | AC | 530 ms | 24492 KB |
test_35.txt | AC | 728 ms | 31984 KB |
test_36.txt | TLE | 2082 ms | 51644 KB |
test_37.txt | TLE | 2056 ms | 49828 KB |
test_38.txt | AC | 1862 ms | 47664 KB |
test_39.txt | TLE | 2067 ms | 49660 KB |
test_40.txt | TLE | 2080 ms | 49028 KB |
test_41.txt | AC | 1651 ms | 47544 KB |
test_42.txt | AC | 1687 ms | 47152 KB |
test_43.txt | AC | 1630 ms | 48088 KB |