Submission #224920
Source Code Expand
import java.util.Scanner; import java.util.ArrayList; import java.util.List; import java.util.Collections; import java.util.Arrays; import java.util.Comparator; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); List<Time> al = new ArrayList<>(); ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>(); for(int i = 0; i < N; i++){ String temp = scan.next(); al.add(new Time(Integer.parseInt(temp.split("-")[0]),Integer.parseInt(temp.split("-")[1]))); } Collections.sort(al, new Comparator<Time>(){ @Override public int compare(Time o1, Time o2){ if(o1 == null && o2 == null) return 0; else if(o1 == null) return 1; else if(o2 == null) return -1; return (o1.start - o2.start); } }); for(int i = 0; i < N; i++){ System.out.println(al.get(i).start + "-" + al.get(i).end); } int start = al.get(0).start; int end = al.get(0).end; System.out.println(); for(int i = 1; i < N; i++){ if(al.get(i).start > end){ disp(start, end); start = al.get(i).start; end = al.get(i).end; }else if(end <= al.get(i).start && end <= al.get(i).end){ end = al.get(i).end; } if(i == N - 1){ disp(start , end); } } } static void disp(int start, int end){ String res = ""; res = Integer.toString((start - start % 60) / 60) + Integer.toString(start % 60) + "-" + Integer.toString((end - end % 60) / 60) + Integer.toString(end % 60); System.out.println(res); } } class Time{ int start; int end; Time(int start,int end){ this.start = start; this.end = end; //to minutes this.start = toMinutes(this.start); this.end = toMinutes(this.end); //round this.start = this.start - this.start % 5; this.end = this.end + 5 - (this.end % 5); } private int toMinutes(int argc){ int res; res = (argc - argc % 100) / 100 * 60 + argc % 100; return res; } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | tuppole |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 2049 Byte |
Status | WA |
Exec Time | 1496 ms |
Memory | 39816 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 | WA | 394 ms | 21284 KB |
00_sample_02.txt | WA | 373 ms | 21416 KB |
00_sample_03.txt | WA | 381 ms | 21428 KB |
cho_cho_chokudai.txt | WA | 1300 ms | 37528 KB |
chokudai_ga_cho.txt | WA | 1330 ms | 38196 KB |
test_01.txt | WA | 407 ms | 21676 KB |
test_02.txt | WA | 403 ms | 21680 KB |
test_03.txt | WA | 405 ms | 21668 KB |
test_04.txt | WA | 397 ms | 21544 KB |
test_05.txt | WA | 403 ms | 21664 KB |
test_06.txt | WA | 426 ms | 22192 KB |
test_07.txt | WA | 405 ms | 21548 KB |
test_08.txt | WA | 399 ms | 21544 KB |
test_09.txt | WA | 473 ms | 23584 KB |
test_10.txt | WA | 474 ms | 23704 KB |
test_11.txt | WA | 462 ms | 22564 KB |
test_12.txt | WA | 447 ms | 22320 KB |
test_13.txt | WA | 411 ms | 21680 KB |
test_14.txt | WA | 462 ms | 23704 KB |
test_15.txt | WA | 482 ms | 23700 KB |
test_16.txt | WA | 411 ms | 21680 KB |
test_17.txt | WA | 467 ms | 23632 KB |
test_18.txt | WA | 417 ms | 21664 KB |
test_19.txt | WA | 455 ms | 22168 KB |
test_20.txt | WA | 465 ms | 22576 KB |
test_21.txt | WA | 1420 ms | 39140 KB |
test_22.txt | WA | 1461 ms | 39484 KB |
test_23.txt | WA | 1391 ms | 39324 KB |
test_24.txt | WA | 1409 ms | 39376 KB |
test_25.txt | WA | 1413 ms | 39052 KB |
test_26.txt | WA | 1430 ms | 39112 KB |
test_27.txt | WA | 1357 ms | 37748 KB |
test_28.txt | WA | 1456 ms | 39692 KB |
test_29.txt | WA | 384 ms | 21296 KB |
test_30.txt | WA | 392 ms | 21412 KB |
test_31.txt | WA | 793 ms | 31920 KB |
test_32.txt | WA | 381 ms | 21424 KB |
test_33.txt | WA | 1328 ms | 38908 KB |
test_34.txt | WA | 381 ms | 21424 KB |
test_35.txt | WA | 422 ms | 21928 KB |
test_36.txt | WA | 1416 ms | 39608 KB |
test_37.txt | WA | 1388 ms | 39340 KB |
test_38.txt | WA | 1401 ms | 39544 KB |
test_39.txt | WA | 1429 ms | 39684 KB |
test_40.txt | WA | 1403 ms | 38776 KB |
test_41.txt | WA | 1315 ms | 37612 KB |
test_42.txt | WA | 1496 ms | 39816 KB |
test_43.txt | WA | 1374 ms | 37092 KB |