Submission #133823
Source Code Expand
import java.util.Arrays; import java.util.Scanner; public class Main { public static int marume(int time, int flag){ int marume = time; if(marume%5==0){return marume;} else{ while(marume%5!=0){ if(flag==0){marume=marume-1;} else{marume=marume+1;} } if(flag == 1){ String m_str = Integer.toString(marume); if(marume>=1000){m_str = m_str.substring(2);} else if(marume<1000){m_str = m_str.substring(1);} if(m_str.equals("60")){ marume = marume+40; } } return marume; } } public static void main(String[] args){ Scanner stdin = new Scanner(System.in); int N = stdin.nextInt(); String[] time = new String[N]; for(int i=0; i<N; i++){ time[i] = stdin.next(); } Arrays.sort(time); int[] start = new int[N]; int[] end = new int[N]; for(int i=0; i<N; i++){ String[] time2 = time[i].split("-"); start[i] = Integer.parseInt(time2[0]); start[i] = marume(start[i],0); end[i] = Integer.parseInt(time2[1]); end[i] = marume(end[i],1); } int[] flag = new int[N]; Arrays.fill(flag, 0); for(int i=0; i<N; i++){ if(flag[i]==0){ for(int j=i+1; j<N; j++){ if(end[i]>=start[j]){ //System.out.println("tes1"); if(end[i]<=end[j]){ end[i]=end[j]; } flag[j]=1; if(j==N-1)System.out.println(String.format("%04d",start[i])+"-"+String.format("%04d",end[i])); }else{ //System.out.println("tes2"); System.out.println(String.format("%04d",start[i])+"-"+String.format("%04d",end[i])); break; } } if(i==N-1){ System.out.println(String.format("%04d",start[i])+"-"+String.format("%04d",end[i])); } } } } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | tororo_roror |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 1746 Byte |
Status | WA |
Exec Time | 1140 ms |
Memory | 43976 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 | 497 ms | 23600 KB |
00_sample_02.txt | AC | 470 ms | 23728 KB |
00_sample_03.txt | AC | 460 ms | 23696 KB |
cho_cho_chokudai.txt | AC | 1079 ms | 43960 KB |
chokudai_ga_cho.txt | AC | 982 ms | 43752 KB |
test_01.txt | AC | 501 ms | 24236 KB |
test_02.txt | AC | 500 ms | 24112 KB |
test_03.txt | AC | 488 ms | 24116 KB |
test_04.txt | AC | 519 ms | 24236 KB |
test_05.txt | AC | 500 ms | 24232 KB |
test_06.txt | AC | 482 ms | 24492 KB |
test_07.txt | AC | 476 ms | 23856 KB |
test_08.txt | AC | 470 ms | 23720 KB |
test_09.txt | AC | 529 ms | 25900 KB |
test_10.txt | AC | 532 ms | 25588 KB |
test_11.txt | AC | 515 ms | 24496 KB |
test_12.txt | AC | 501 ms | 24240 KB |
test_13.txt | AC | 487 ms | 23984 KB |
test_14.txt | AC | 524 ms | 25748 KB |
test_15.txt | AC | 518 ms | 25468 KB |
test_16.txt | AC | 479 ms | 23980 KB |
test_17.txt | AC | 524 ms | 25820 KB |
test_18.txt | AC | 496 ms | 23920 KB |
test_19.txt | AC | 515 ms | 24320 KB |
test_20.txt | AC | 525 ms | 24624 KB |
test_21.txt | AC | 1057 ms | 43812 KB |
test_22.txt | AC | 1067 ms | 43604 KB |
test_23.txt | AC | 1079 ms | 43400 KB |
test_24.txt | AC | 1067 ms | 41428 KB |
test_25.txt | AC | 1140 ms | 43348 KB |
test_26.txt | WA | 1088 ms | 43332 KB |
test_27.txt | AC | 1042 ms | 41760 KB |
test_28.txt | AC | 1099 ms | 43508 KB |
test_29.txt | AC | 481 ms | 23696 KB |
test_30.txt | AC | 487 ms | 23728 KB |
test_31.txt | WA | 724 ms | 31216 KB |
test_32.txt | AC | 481 ms | 23728 KB |
test_33.txt | AC | 1136 ms | 40488 KB |
test_34.txt | AC | 499 ms | 23604 KB |
test_35.txt | AC | 502 ms | 24368 KB |
test_36.txt | AC | 1034 ms | 43320 KB |
test_37.txt | AC | 1111 ms | 43776 KB |
test_38.txt | AC | 1050 ms | 43232 KB |
test_39.txt | AC | 1098 ms | 43592 KB |
test_40.txt | AC | 1079 ms | 43548 KB |
test_41.txt | AC | 960 ms | 43976 KB |
test_42.txt | AC | 1083 ms | 42564 KB |
test_43.txt | AC | 932 ms | 41360 KB |