Submission #110428
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class Main { private static BufferedReader br = null; static { br = new BufferedReader(new InputStreamReader(System.in)); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<String> lst = new ArrayList<String>(); String bgn = null; String fin = null; int cnt = parseCnt(); int stk = 0; for (int i = 0; i < cnt; i++) { String[] rng = parseRange(); lst.add(rng[0]); lst.add(rng[1]); } Collections.sort(lst); for (int i = 0; i < cnt*2; i++) { String rec = lst.get(i); if (rec.endsWith(":1")) { if (stk++==0) { bgn = rec.substring(0, 4); } } else { stk--; } if (stk == 0) { fin = rec.substring(0, 4); System.out.println(bgn+"-"+fin); } } } private static String[] parseRange() { String[] rng = null; String str = null; if ((str = parseStdin()) != null) { String[] line = str.split("-"); int tmp1 = Integer.parseInt(line[0]); int tmp2 = Integer.parseInt(line[1]); tmp1 = (tmp1/100)*60 + tmp1%100; tmp2 = (tmp2/100)*60 + tmp2%100; tmp1 = (tmp1/5)*5; tmp2 = (tmp2/5+(((tmp2%5)>0)?1:0))*5; rng = new String[2]; rng[0] = String.format("%04d:%d", ((tmp1)/60)*100+((tmp1)%60), 1); rng[1] = String.format("%04d:%d", ((tmp2)/60)*100+((tmp2)%60), 2); } return rng; } private static int parseCnt() { int cnt = 0; String str = null; if ((str = parseStdin()) != null) { cnt = Integer.parseInt(str); } return cnt; } private static String parseStdin() { String stdin = null; try { String tmp = br.readLine(); if (tmp != null) { if (!tmp.isEmpty()) stdin = tmp; } } catch (IOException e) {} return stdin; } }
Submission Info
Submission Time | |
---|---|
Task | D - 感雨時刻の整理 |
User | aramaki |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 2020 Byte |
Status | AC |
Exec Time | 1738 ms |
Memory | 53004 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 | 400 ms | 21204 KB |
00_sample_02.txt | AC | 401 ms | 21228 KB |
00_sample_03.txt | AC | 402 ms | 21208 KB |
cho_cho_chokudai.txt | AC | 1637 ms | 51980 KB |
chokudai_ga_cho.txt | AC | 1650 ms | 51016 KB |
test_01.txt | AC | 468 ms | 22620 KB |
test_02.txt | AC | 480 ms | 22624 KB |
test_03.txt | AC | 482 ms | 22752 KB |
test_04.txt | AC | 443 ms | 22748 KB |
test_05.txt | AC | 440 ms | 22616 KB |
test_06.txt | AC | 466 ms | 22996 KB |
test_07.txt | AC | 452 ms | 22876 KB |
test_08.txt | AC | 436 ms | 22624 KB |
test_09.txt | AC | 548 ms | 26024 KB |
test_10.txt | AC | 586 ms | 26452 KB |
test_11.txt | AC | 565 ms | 25704 KB |
test_12.txt | AC | 504 ms | 25300 KB |
test_13.txt | AC | 458 ms | 23124 KB |
test_14.txt | AC | 578 ms | 25948 KB |
test_15.txt | AC | 578 ms | 26452 KB |
test_16.txt | AC | 466 ms | 22740 KB |
test_17.txt | AC | 558 ms | 25916 KB |
test_18.txt | AC | 451 ms | 22992 KB |
test_19.txt | AC | 517 ms | 25380 KB |
test_20.txt | AC | 547 ms | 25520 KB |
test_21.txt | AC | 1456 ms | 50124 KB |
test_22.txt | AC | 1569 ms | 51820 KB |
test_23.txt | AC | 1395 ms | 46300 KB |
test_24.txt | AC | 1530 ms | 52252 KB |
test_25.txt | AC | 1571 ms | 51344 KB |
test_26.txt | AC | 1360 ms | 48088 KB |
test_27.txt | AC | 1532 ms | 49384 KB |
test_28.txt | AC | 1738 ms | 52520 KB |
test_29.txt | AC | 405 ms | 21220 KB |
test_30.txt | AC | 411 ms | 21468 KB |
test_31.txt | AC | 1109 ms | 47464 KB |
test_32.txt | AC | 411 ms | 21340 KB |
test_33.txt | AC | 1348 ms | 49156 KB |
test_34.txt | AC | 399 ms | 21212 KB |
test_35.txt | AC | 479 ms | 24044 KB |
test_36.txt | AC | 1507 ms | 52884 KB |
test_37.txt | AC | 1477 ms | 50492 KB |
test_38.txt | AC | 1474 ms | 51312 KB |
test_39.txt | AC | 1329 ms | 48364 KB |
test_40.txt | AC | 1571 ms | 52480 KB |
test_41.txt | AC | 1554 ms | 52504 KB |
test_42.txt | AC | 1429 ms | 53004 KB |
test_43.txt | AC | 1572 ms | 52600 KB |