Submission #602842
Source Code Expand
import java.io.*; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[][] se = new int[n][2]; String[] d = new String[2]; for(int i = 0;i < n;i++){ d = br.readLine().split("-"); se[i][0] = Integer.parseInt(d[0]); se[i][0] = se[i][0] / 10 * 10 + (se[i][0] % 10 < 5 ? 0 : 5); se[i][1] = Integer.parseInt(d[1]); if(se[i][1] % 100 > 55){ se[i][1] = (se[i][1] / 100 + 1) * 100; }else if(se[i][1] % 5 > 0){ se[i][1] = se[i][1] / 10 * 10 + (se[i][1] % 10 < 5 ? 5 : 10); } } quick(se , 0 , n - 1); int[][] se_ans = new int[n][2]; se_ans[0][0] = se[0][0]; se_ans[0][1] = se[0][1]; int se_n = 0; for(int i = 1;i < n;i++){ if(se_ans[se_n][0] <= se[i][0] && se[i][0] <= se_ans[se_n][1]){ if(se_ans[se_n][1] < se[i][1]) se_ans[se_n][1] = se[i][1]; }else{ se_n++; se_ans[se_n][0] = se[i][0]; se_ans[se_n][1] = se[i][1]; } } for(int i = 0;i <= se_n;i++){ System.out.printf("%04d-%04d\n" , se_ans[i][0] , se_ans[i][1]); } } public static void quick(int[][] se, int r , int l){ int rr = r , ll = l , m = se[(r + l) / 2][0] , w = 0; while(rr <= ll){ while(se[rr][0] < m) rr++; while(se[ll][0] > m) ll--; if(rr <= ll){ w = se[rr][0]; se[rr][0] = se[ll][0]; se[ll][0] = w; w = se[rr][1]; se[rr][1] = se[ll][1]; se[ll][1] = w; rr++; ll--; } } if(r < ll) quick(se , r , ll); if(rr < l) quick(se , rr , l); } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | who |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 1640 Byte |
Status | AC |
Exec Time | 653 ms |
Memory | 36452 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 | 327 ms | 21044 KB |
00_sample_02.txt | AC | 327 ms | 21152 KB |
00_sample_03.txt | AC | 330 ms | 21160 KB |
cho_cho_chokudai.txt | AC | 615 ms | 34216 KB |
chokudai_ga_cho.txt | AC | 616 ms | 33672 KB |
test_01.txt | AC | 368 ms | 22188 KB |
test_02.txt | AC | 376 ms | 22280 KB |
test_03.txt | AC | 378 ms | 22244 KB |
test_04.txt | AC | 378 ms | 22212 KB |
test_05.txt | AC | 381 ms | 22188 KB |
test_06.txt | AC | 331 ms | 21252 KB |
test_07.txt | AC | 322 ms | 21280 KB |
test_08.txt | AC | 323 ms | 21164 KB |
test_09.txt | AC | 342 ms | 22220 KB |
test_10.txt | AC | 351 ms | 22336 KB |
test_11.txt | AC | 345 ms | 22136 KB |
test_12.txt | AC | 338 ms | 22144 KB |
test_13.txt | AC | 333 ms | 21272 KB |
test_14.txt | AC | 342 ms | 22124 KB |
test_15.txt | AC | 345 ms | 22380 KB |
test_16.txt | AC | 326 ms | 21280 KB |
test_17.txt | AC | 365 ms | 22068 KB |
test_18.txt | AC | 413 ms | 21172 KB |
test_19.txt | AC | 394 ms | 22192 KB |
test_20.txt | AC | 379 ms | 22060 KB |
test_21.txt | AC | 596 ms | 34164 KB |
test_22.txt | AC | 617 ms | 33576 KB |
test_23.txt | AC | 627 ms | 35740 KB |
test_24.txt | AC | 629 ms | 34020 KB |
test_25.txt | AC | 629 ms | 36276 KB |
test_26.txt | AC | 601 ms | 33852 KB |
test_27.txt | AC | 612 ms | 32972 KB |
test_28.txt | AC | 603 ms | 33868 KB |
test_29.txt | AC | 323 ms | 21168 KB |
test_30.txt | AC | 325 ms | 21224 KB |
test_31.txt | AC | 467 ms | 26796 KB |
test_32.txt | AC | 323 ms | 21224 KB |
test_33.txt | AC | 609 ms | 36096 KB |
test_34.txt | AC | 323 ms | 21200 KB |
test_35.txt | AC | 328 ms | 21276 KB |
test_36.txt | AC | 624 ms | 36036 KB |
test_37.txt | AC | 648 ms | 33956 KB |
test_38.txt | AC | 653 ms | 35508 KB |
test_39.txt | AC | 633 ms | 34144 KB |
test_40.txt | AC | 647 ms | 35852 KB |
test_41.txt | AC | 632 ms | 35536 KB |
test_42.txt | AC | 634 ms | 33492 KB |
test_43.txt | AC | 648 ms | 36452 KB |