Submission #1913185
Source Code Expand
import java.util.*; import static java.util.Comparator.*; import java.util.stream.Collectors; public class Main{ static public void main(String[] args){ Scanner scan = new Scanner(System.in); int size = scan.nextInt(); List<String> list = new ArrayList<>(); for(int i = 0; i < size;i++){ list.add(scan.next()); } list.sort(naturalOrder()); list = list.stream().map(o -> { String[] record = o.split("-"); int start = Integer.parseInt(record[0]); int end = Integer.parseInt(record[1]); start -= start % 5; if(end % 5 > 0){ end += 5 - end % 5; } if(end % 100 == 60){ end += 40; } return "" +start + "-" + end; }).collect(Collectors.toList()); List<String> result = new ArrayList<>(); int start = 9999; int end = -1; for(String data : list){ String[] record = data.split("-"); int _start = Integer.parseInt(record[0]); int _end = Integer.parseInt(record[1]); if (start > _start || _start > end ){ if(start != 9999){ result.add(String.format("%04d-%04d",start , end)); } start = _start; end = -1; } if(end < _end){ end = _end; } } result.add(String.format("%04d-%04d",start , end)); result.stream().forEach(System.out::println); } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | tohruok |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 1337 Byte |
Status | AC |
Exec Time | 555 ms |
Memory | 49720 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 | 188 ms | 27220 KB |
00_sample_02.txt | AC | 175 ms | 26964 KB |
00_sample_03.txt | AC | 177 ms | 24916 KB |
cho_cho_chokudai.txt | AC | 531 ms | 47160 KB |
chokudai_ga_cho.txt | AC | 472 ms | 47416 KB |
test_01.txt | AC | 215 ms | 23764 KB |
test_02.txt | AC | 209 ms | 26960 KB |
test_03.txt | AC | 219 ms | 27084 KB |
test_04.txt | AC | 224 ms | 26832 KB |
test_05.txt | AC | 212 ms | 29012 KB |
test_06.txt | AC | 214 ms | 25044 KB |
test_07.txt | AC | 195 ms | 26312 KB |
test_08.txt | AC | 193 ms | 26956 KB |
test_09.txt | AC | 216 ms | 25172 KB |
test_10.txt | AC | 245 ms | 29240 KB |
test_11.txt | AC | 247 ms | 29868 KB |
test_12.txt | AC | 218 ms | 27092 KB |
test_13.txt | AC | 213 ms | 24660 KB |
test_14.txt | AC | 224 ms | 25556 KB |
test_15.txt | AC | 246 ms | 30836 KB |
test_16.txt | AC | 200 ms | 26964 KB |
test_17.txt | AC | 248 ms | 27568 KB |
test_18.txt | AC | 196 ms | 24916 KB |
test_19.txt | AC | 216 ms | 24396 KB |
test_20.txt | AC | 248 ms | 29856 KB |
test_21.txt | AC | 555 ms | 49064 KB |
test_22.txt | AC | 468 ms | 46800 KB |
test_23.txt | AC | 475 ms | 46996 KB |
test_24.txt | AC | 471 ms | 47940 KB |
test_25.txt | AC | 538 ms | 49720 KB |
test_26.txt | AC | 484 ms | 48808 KB |
test_27.txt | AC | 544 ms | 47468 KB |
test_28.txt | AC | 481 ms | 47228 KB |
test_29.txt | AC | 176 ms | 27220 KB |
test_30.txt | AC | 190 ms | 24788 KB |
test_31.txt | AC | 355 ms | 30844 KB |
test_32.txt | AC | 182 ms | 25044 KB |
test_33.txt | AC | 475 ms | 46416 KB |
test_34.txt | AC | 179 ms | 26964 KB |
test_35.txt | AC | 208 ms | 25300 KB |
test_36.txt | AC | 520 ms | 49492 KB |
test_37.txt | AC | 502 ms | 48892 KB |
test_38.txt | AC | 476 ms | 46692 KB |
test_39.txt | AC | 517 ms | 47088 KB |
test_40.txt | AC | 496 ms | 49228 KB |
test_41.txt | AC | 432 ms | 47832 KB |
test_42.txt | AC | 490 ms | 47324 KB |
test_43.txt | AC | 454 ms | 48124 KB |