Submission #110430


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<Integer>	lst = new ArrayList<Integer>();
		Integer				bgn = null;
		Integer				fin = null;
		int					cnt = parseCnt();
		int					stk = 0;

		for (int i = 0; i < cnt; i++) {
			Integer[]	rng = parseRange();

			lst.add(rng[0]);
			lst.add(rng[1]);
		}

		Collections.sort(lst);

		for (int i = 0; i < cnt*2; i++) {
			Integer	rec = lst.get(i);
			if (rec%10==1) {
				if (stk++==0) {
					bgn = rec/10;
				}
			} else {
				stk--;
			}

			if (stk == 0) {
				fin = rec/10;
				System.out.println(String.format("%04d-%04d", bgn, fin));
			}
		}
	}

	private static Integer[] parseRange() {
		Integer[]	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 Integer[2];

			rng[0] = (((tmp1)/60)*100+((tmp1)%60))*10+1;
			rng[1] = (((tmp2)/60)*100+((tmp2)%60))*10+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 1975 Byte
Status AC
Exec Time 971 ms
Memory 35492 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 48
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 390 ms 21212 KB
00_sample_02.txt AC 391 ms 21344 KB
00_sample_03.txt AC 387 ms 21340 KB
cho_cho_chokudai.txt AC 721 ms 33680 KB
chokudai_ga_cho.txt AC 753 ms 35476 KB
test_01.txt AC 434 ms 22040 KB
test_02.txt AC 463 ms 22108 KB
test_03.txt AC 439 ms 22104 KB
test_04.txt AC 444 ms 22112 KB
test_05.txt AC 434 ms 21980 KB
test_06.txt AC 405 ms 21464 KB
test_07.txt AC 410 ms 21332 KB
test_08.txt AC 406 ms 21348 KB
test_09.txt AC 425 ms 22368 KB
test_10.txt AC 430 ms 22500 KB
test_11.txt AC 421 ms 22368 KB
test_12.txt AC 414 ms 22360 KB
test_13.txt AC 408 ms 21340 KB
test_14.txt AC 418 ms 22360 KB
test_15.txt AC 421 ms 22384 KB
test_16.txt AC 412 ms 21344 KB
test_17.txt AC 430 ms 22368 KB
test_18.txt AC 411 ms 21336 KB
test_19.txt AC 428 ms 22236 KB
test_20.txt AC 432 ms 22364 KB
test_21.txt AC 745 ms 34684 KB
test_22.txt AC 778 ms 34840 KB
test_23.txt AC 756 ms 34936 KB
test_24.txt AC 797 ms 35008 KB
test_25.txt AC 754 ms 35336 KB
test_26.txt AC 772 ms 34380 KB
test_27.txt AC 722 ms 34032 KB
test_28.txt AC 754 ms 35072 KB
test_29.txt AC 419 ms 21340 KB
test_30.txt AC 430 ms 21340 KB
test_31.txt AC 563 ms 29016 KB
test_32.txt AC 399 ms 21332 KB
test_33.txt AC 749 ms 34960 KB
test_34.txt AC 412 ms 21340 KB
test_35.txt AC 410 ms 21464 KB
test_36.txt AC 765 ms 34656 KB
test_37.txt AC 971 ms 35492 KB
test_38.txt AC 793 ms 34760 KB
test_39.txt AC 750 ms 34828 KB
test_40.txt AC 752 ms 34584 KB
test_41.txt AC 712 ms 34204 KB
test_42.txt AC 745 ms 34984 KB
test_43.txt AC 692 ms 33596 KB