Submission #133824
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 && marume>=100){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 | 100 |
Code Size | 1761 Byte |
Status | AC |
Exec Time | 1111 ms |
Memory | 44060 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 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 | 946 ms | 23596 KB |
00_sample_02.txt | AC | 466 ms | 23712 KB |
00_sample_03.txt | AC | 467 ms | 23536 KB |
cho_cho_chokudai.txt | AC | 1045 ms | 42828 KB |
chokudai_ga_cho.txt | AC | 955 ms | 41868 KB |
test_01.txt | AC | 524 ms | 24196 KB |
test_02.txt | AC | 512 ms | 24232 KB |
test_03.txt | AC | 509 ms | 24240 KB |
test_04.txt | AC | 525 ms | 24104 KB |
test_05.txt | AC | 520 ms | 24116 KB |
test_06.txt | AC | 488 ms | 24112 KB |
test_07.txt | AC | 487 ms | 23856 KB |
test_08.txt | AC | 482 ms | 23848 KB |
test_09.txt | AC | 553 ms | 25680 KB |
test_10.txt | AC | 550 ms | 25788 KB |
test_11.txt | AC | 531 ms | 24720 KB |
test_12.txt | AC | 521 ms | 24240 KB |
test_13.txt | AC | 491 ms | 23856 KB |
test_14.txt | AC | 525 ms | 25700 KB |
test_15.txt | AC | 528 ms | 25916 KB |
test_16.txt | AC | 485 ms | 23856 KB |
test_17.txt | AC | 534 ms | 25920 KB |
test_18.txt | AC | 483 ms | 23856 KB |
test_19.txt | AC | 502 ms | 24236 KB |
test_20.txt | AC | 506 ms | 25000 KB |
test_21.txt | AC | 1086 ms | 42848 KB |
test_22.txt | AC | 1049 ms | 43112 KB |
test_23.txt | AC | 1022 ms | 43424 KB |
test_24.txt | AC | 1109 ms | 43212 KB |
test_25.txt | AC | 1067 ms | 43896 KB |
test_26.txt | AC | 1074 ms | 43548 KB |
test_27.txt | AC | 986 ms | 42448 KB |
test_28.txt | AC | 1088 ms | 44060 KB |
test_29.txt | AC | 461 ms | 23588 KB |
test_30.txt | AC | 472 ms | 23852 KB |
test_31.txt | AC | 709 ms | 31712 KB |
test_32.txt | AC | 491 ms | 23692 KB |
test_33.txt | AC | 1098 ms | 42012 KB |
test_34.txt | AC | 465 ms | 23600 KB |
test_35.txt | AC | 494 ms | 24216 KB |
test_36.txt | AC | 1081 ms | 43696 KB |
test_37.txt | AC | 1111 ms | 43600 KB |
test_38.txt | AC | 1072 ms | 43484 KB |
test_39.txt | AC | 1040 ms | 41984 KB |
test_40.txt | AC | 1091 ms | 42168 KB |
test_41.txt | AC | 950 ms | 42924 KB |
test_42.txt | AC | 1039 ms | 42248 KB |
test_43.txt | AC | 935 ms | 40972 KB |