Submission #176830
Source Code Expand
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main { static int SE[][]; static int ansSE[][]; static int N; static int ans; public static void main(String[] args) { readInput(); Arrays.sort(SE, new MyComparator()); round(SE); ans = merge(SE, ansSE); dump(ansSE, ans); } private static void readInput() { Scanner sc = new Scanner(System.in); N = sc.nextInt(); SE = new int[N][2]; ansSE = new int[N][2]; String temp[] = new String[2]; for (int i = 0; i < N; i++) { temp = (sc.next()).split("-"); SE[i][0] = Integer.parseInt(temp[0]); SE[i][1] = Integer.parseInt(temp[1]); } } private static void round(int[][] SE) { int s, e; for (int i = 0; i < SE.length; i++) { s = SE[i][0]; e = SE[i][1]; s = s - (s % 5); if ((e % 5) != 0) e = e + (5 - e % 5); if ((e % 100) == 60) { e = e + 40; } SE[i][0] = s; SE[i][1] = e; } } private static int merge(int[][] SE, int[][] ansSE) { int srt = SE[0][0]; int end = SE[0][1]; int index = 0; for (int i = 1; i < SE.length; i++) { if (SE[i][0] <= end) { if (SE[i][1] > end) { end = SE[i][1]; } } else { ansSE[index][0] = srt; ansSE[index][1] = end; srt = SE[i][0]; end = SE[i][1]; index++; } } ansSE[index][0] = srt; ansSE[index][1] = end; return index+1; } private static void dump(int[][] se, int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { System.out.print(se[i][j]); if (j == 0) System.out.print("-"); } System.out.println(""); } } private static class MyComparator implements Comparator<Object> { @Override public int compare(Object o1, Object o2) { int s1 = ((int[])o1)[0]; int s2 = ((int[])o2)[0]; return s1 - s2; } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | fukumy |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 1952 Byte |
Status | WA |
Exec Time | 1114 ms |
Memory | 40252 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 | 473 ms | 19944 KB |
00_sample_02.txt | WA | 414 ms | 19772 KB |
00_sample_03.txt | AC | 433 ms | 19884 KB |
cho_cho_chokudai.txt | WA | 885 ms | 37544 KB |
chokudai_ga_cho.txt | WA | 872 ms | 38576 KB |
test_01.txt | WA | 463 ms | 20128 KB |
test_02.txt | WA | 437 ms | 20236 KB |
test_03.txt | WA | 442 ms | 20112 KB |
test_04.txt | WA | 441 ms | 20112 KB |
test_05.txt | WA | 444 ms | 20164 KB |
test_06.txt | WA | 463 ms | 20772 KB |
test_07.txt | WA | 433 ms | 20140 KB |
test_08.txt | WA | 432 ms | 20040 KB |
test_09.txt | WA | 485 ms | 21344 KB |
test_10.txt | WA | 481 ms | 21308 KB |
test_11.txt | WA | 479 ms | 21180 KB |
test_12.txt | WA | 460 ms | 20864 KB |
test_13.txt | WA | 447 ms | 20168 KB |
test_14.txt | WA | 469 ms | 21044 KB |
test_15.txt | WA | 491 ms | 21348 KB |
test_16.txt | WA | 427 ms | 20236 KB |
test_17.txt | WA | 493 ms | 21348 KB |
test_18.txt | WA | 445 ms | 20188 KB |
test_19.txt | WA | 490 ms | 20524 KB |
test_20.txt | WA | 480 ms | 21256 KB |
test_21.txt | WA | 979 ms | 38372 KB |
test_22.txt | WA | 939 ms | 39104 KB |
test_23.txt | WA | 1114 ms | 37972 KB |
test_24.txt | WA | 1053 ms | 39876 KB |
test_25.txt | WA | 1058 ms | 39336 KB |
test_26.txt | WA | 1054 ms | 40116 KB |
test_27.txt | WA | 980 ms | 38204 KB |
test_28.txt | WA | 1038 ms | 38924 KB |
test_29.txt | WA | 458 ms | 19912 KB |
test_30.txt | WA | 485 ms | 19888 KB |
test_31.txt | WA | 695 ms | 25800 KB |
test_32.txt | WA | 599 ms | 19932 KB |
test_33.txt | WA | 962 ms | 37104 KB |
test_34.txt | WA | 465 ms | 19940 KB |
test_35.txt | WA | 493 ms | 20828 KB |
test_36.txt | WA | 1074 ms | 40252 KB |
test_37.txt | WA | 1005 ms | 39936 KB |
test_38.txt | WA | 1029 ms | 39616 KB |
test_39.txt | WA | 1021 ms | 38124 KB |
test_40.txt | WA | 973 ms | 39604 KB |
test_41.txt | WA | 888 ms | 36848 KB |
test_42.txt | WA | 903 ms | 38516 KB |
test_43.txt | WA | 884 ms | 36900 KB |