Submission #370508
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] S = new int [n]; int[] E = new int [n]; if (n==1) { String str = sc.next(); String[] division = str.split("-"); S[0] = Integer.parseInt(division[0]); E[0] = Integer.parseInt(division[1]); if(S[0]<10) System.out.print("000"); else if(S[0]<100) System.out.print("00"); else if(S[0]<1000) System.out.print("0"); System.out.print(S[0]+"-"); if(E[0]<10) System.out.print("000"); else if(E[0]<100) System.out.print("00"); else if(E[0]<1000) System.out.print("0"); System.out.println(E[0]); } if (n>1) { for(int i=0; i<n; i++) { String str = sc.next(); String[] division = str.split("-"); S[i] = Integer.parseInt(division[0]); if (S[i]%10 < 5) S[i] = S[i] - S[i]%10; else if (S[i]%10 >= 5) S[i]= (S[i]-S[i]%10)+5; E[i] = Integer.parseInt(division[1]); if (0 < E[i]%10 && E[i]%10 <= 5) E[i] = (E[i] - E[i]%10)+5; else if (E[i]%10 >= 5) E[i]= (E[i]-E[i]%10)+10; } //For sorting for(int i=0; i<n-1 ; i++) for (int j=i+1 ; j<n; j++) { if(S[i] > S[j]) { int temp = S[j]; S[j] = S[i]; S[i] = temp; int temp2 = E[j]; E[j] = E[i]; E[i] = temp2; } if(S[i] == S[j] && E[i] > E[j]) { int temp3 = E[j]; E[j] = E[i]; E[i] = temp3; } } for(int i = 0 ; i<n-1 ; i++) { if(S[i] <= S[i+1] && S[i+1] <= E[i]) { if (S[i] >= S[i+1]) S[i] = S[i+1]; else if (S[i] < S[i+1]) S[i+1] = S[i]; if(E[i] >= E[i+1]) E[i+1] = E[i]; else if(E[i] < E[i+1]) E[i] = E[i+1]; } } for (int i=0; i<n-1; i++) { if(S[i] != S[i+1]) { if(S[i]<10) System.out.print("000"); else if(S[i]<100) System.out.print("00"); else if(S[i]<1000) System.out.print("0"); System.out.print(S[i]+"-"); if(E[i]<10) System.out.print("000"); else if(E[i]<100) System.out.print("00"); else if(E[i]<1000) System.out.print("0"); System.out.println(E[i]); } } if(S[n-2] != S[n-1] || S[n-2] == S[n-1] && E[n-2] == E[n-1]) { if(S[n-1]<10) System.out.print("000"); else if(S[n-1]<100) System.out.print("00"); else if(S[n-1]<1000) System.out.print("0"); System.out.print(S[n-1]+"-"); if(E[n-1]<10) System.out.print("000"); else if(E[n-1]<100) System.out.print("00"); else if(E[n-1]<1000) System.out.print("0"); System.out.println(E[n-1]); } if(S[n-2] == S[n-1] && E[n-2] == E[n-1]) { if(S[n-1]<10) System.out.print("000"); else if(S[n-1]<100) System.out.print("00"); else if(S[n-1]<1000) System.out.print("0"); System.out.print(S[n-1]+"-"); if(E[n-1]<10) System.out.print("000"); else if(E[n-1]<100) System.out.print("00"); else if(E[n-1]<1000) System.out.print("0"); System.out.println(E[n-1]); } } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | seoninlife |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 3387 Byte |
Status | TLE |
Exec Time | 4556 ms |
Memory | 40108 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 | 388 ms | 22836 KB |
00_sample_02.txt | AC | 385 ms | 22760 KB |
00_sample_03.txt | AC | 385 ms | 22836 KB |
cho_cho_chokudai.txt | TLE | 2612 ms | 39344 KB |
chokudai_ga_cho.txt | TLE | 2040 ms | 40108 KB |
test_01.txt | AC | 425 ms | 22992 KB |
test_02.txt | AC | 420 ms | 22988 KB |
test_03.txt | AC | 426 ms | 22888 KB |
test_04.txt | AC | 434 ms | 22972 KB |
test_05.txt | AC | 417 ms | 23056 KB |
test_06.txt | WA | 415 ms | 23108 KB |
test_07.txt | WA | 404 ms | 23024 KB |
test_08.txt | WA | 398 ms | 22844 KB |
test_09.txt | WA | 472 ms | 25464 KB |
test_10.txt | WA | 478 ms | 26060 KB |
test_11.txt | WA | 466 ms | 24556 KB |
test_12.txt | WA | 451 ms | 24384 KB |
test_13.txt | WA | 415 ms | 23272 KB |
test_14.txt | WA | 472 ms | 25268 KB |
test_15.txt | WA | 488 ms | 26280 KB |
test_16.txt | WA | 420 ms | 23200 KB |
test_17.txt | WA | 473 ms | 25288 KB |
test_18.txt | WA | 432 ms | 23384 KB |
test_19.txt | WA | 457 ms | 24432 KB |
test_20.txt | WA | 461 ms | 23964 KB |
test_21.txt | TLE | 2039 ms | 39740 KB |
test_22.txt | TLE | 2041 ms | 39248 KB |
test_23.txt | TLE | 2040 ms | 39312 KB |
test_24.txt | TLE | 2041 ms | 39796 KB |
test_25.txt | TLE | 4556 ms | 39104 KB |
test_26.txt | TLE | 2041 ms | 39548 KB |
test_27.txt | TLE | 2960 ms | 38940 KB |
test_28.txt | TLE | 2040 ms | 39328 KB |
test_29.txt | WA | 380 ms | 22840 KB |
test_30.txt | WA | 389 ms | 22836 KB |
test_31.txt | WA | 686 ms | 28956 KB |
test_32.txt | WA | 390 ms | 22804 KB |
test_33.txt | TLE | 2040 ms | 38924 KB |
test_34.txt | AC | 384 ms | 22856 KB |
test_35.txt | WA | 427 ms | 23808 KB |
test_36.txt | TLE | 2041 ms | 39840 KB |
test_37.txt | TLE | 2040 ms | 39596 KB |
test_38.txt | TLE | 2040 ms | 39332 KB |
test_39.txt | TLE | 2041 ms | 39496 KB |
test_40.txt | TLE | 2046 ms | 39212 KB |
test_41.txt | WA | 1560 ms | 38952 KB |
test_42.txt | TLE | 2040 ms | 39132 KB |
test_43.txt | TLE | 2039 ms | 39472 KB |