Submission #370359
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]); System.out.println(S[0]+"-"+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 print // for (int i=0; i<n; i++) // { // System.out.print((i+1)+"th E and S = "); // System.out.println(S[i]+", "+E[i]); // } 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]; } } // System.out.println("==============="); //For print // for (int i=0; i<n; i++) // { // System.out.print((i+1)+"th E and S = "); // System.out.println(S[i]+", "+E[i]); // } for (int i=0; i<n-1; i++) { if(S[i] != S[i+1]) { System.out.println(S[i]+"-"+E[i]); } } if(S[n-2] != S[n-1]) { System.out.println(S[n-1]+"-"+E[n-1]); } if(S[n-2] == S[n-1] && E[n-2] == E[n-1]) { System.out.println(S[n-1]+"-"+E[n-1]); } } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | seoninlife |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 2460 Byte |
Status | TLE |
Exec Time | 4414 ms |
Memory | 39152 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 | 389 ms | 22632 KB |
00_sample_02.txt | WA | 389 ms | 22740 KB |
00_sample_03.txt | AC | 393 ms | 22696 KB |
cho_cho_chokudai.txt | TLE | 2040 ms | 39140 KB |
chokudai_ga_cho.txt | TLE | 2040 ms | 38536 KB |
test_01.txt | WA | 415 ms | 22852 KB |
test_02.txt | WA | 406 ms | 22828 KB |
test_03.txt | WA | 403 ms | 22864 KB |
test_04.txt | WA | 416 ms | 22804 KB |
test_05.txt | WA | 411 ms | 22848 KB |
test_06.txt | WA | 403 ms | 23088 KB |
test_07.txt | WA | 398 ms | 22916 KB |
test_08.txt | WA | 390 ms | 22816 KB |
test_09.txt | WA | 464 ms | 25088 KB |
test_10.txt | WA | 482 ms | 25620 KB |
test_11.txt | WA | 457 ms | 24100 KB |
test_12.txt | WA | 443 ms | 24092 KB |
test_13.txt | WA | 423 ms | 23720 KB |
test_14.txt | WA | 461 ms | 24944 KB |
test_15.txt | WA | 476 ms | 25508 KB |
test_16.txt | WA | 425 ms | 22940 KB |
test_17.txt | WA | 478 ms | 25168 KB |
test_18.txt | WA | 415 ms | 23140 KB |
test_19.txt | WA | 444 ms | 23984 KB |
test_20.txt | WA | 456 ms | 23836 KB |
test_21.txt | TLE | 2041 ms | 38780 KB |
test_22.txt | TLE | 4414 ms | 38680 KB |
test_23.txt | TLE | 2040 ms | 38612 KB |
test_24.txt | TLE | 2041 ms | 39008 KB |
test_25.txt | TLE | 2039 ms | 38400 KB |
test_26.txt | TLE | 2040 ms | 38740 KB |
test_27.txt | TLE | 2041 ms | 38608 KB |
test_28.txt | TLE | 3574 ms | 38992 KB |
test_29.txt | WA | 369 ms | 22716 KB |
test_30.txt | WA | 391 ms | 22700 KB |
test_31.txt | WA | 710 ms | 28428 KB |
test_32.txt | WA | 396 ms | 22768 KB |
test_33.txt | TLE | 2040 ms | 38684 KB |
test_34.txt | WA | 389 ms | 22652 KB |
test_35.txt | WA | 430 ms | 23536 KB |
test_36.txt | TLE | 2040 ms | 38860 KB |
test_37.txt | TLE | 2040 ms | 38932 KB |
test_38.txt | TLE | 3521 ms | 39128 KB |
test_39.txt | TLE | 3756 ms | 39036 KB |
test_40.txt | TLE | 2039 ms | 38868 KB |
test_41.txt | WA | 1569 ms | 38708 KB |
test_42.txt | TLE | 3436 ms | 38784 KB |
test_43.txt | TLE | 2040 ms | 39152 KB |