Submission #349517


Source Code Expand

import java.util.*;

public class Main {
	public static void main(String[] args)
	{
		int n;
		Integer [] start, end;
		String[] data;
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		start = new Integer[n + 1];
		end = new Integer[n];
		data = new String[n];
		
		start[n] = 2401; //番兵
		
		//降り始めから振り終わりまで一行入力
		for(int i = 0; i < n; i++) data[i] = sc.next();
		sc.close();
		
		//時間順(昇順)ソート
		Arrays.sort(data);

		//降り始めと振り終わりに分ける
		separate(start,end, n, data);

		//正規化し出力
		normalization(start, end, n);
	}

	private static void separate(Integer[] start, Integer[] end, int n, String[] data)
	{
		int i;
		for(i = 0; i < n; i++){
			String[] change = (data[i]).split("-");
			marume(start,end,change, i);
			//System.out.println(start[i]);
			//System.out.println(end[i]);
		}
	}

	private static void marume(Integer[] start, Integer[] end, String[] change, int i)
	{
		int tmp;
		//start
		tmp = Integer.parseInt(change[0]);
		start[i] = (tmp - (tmp % 5));

		//end
		tmp = Integer.parseInt(change[1]) + 4;
		end[i] = (tmp - (tmp % 5));
		if(end[i] % 100 == 60) end[i] += 40;
	}

	private static void normalization(Integer[] start, Integer[] end, int n)
	{
		int i,k,nextIdx;
		for(i = 0; i < n; i++){
			nextIdx = i + 1;
			if(end[i] < start[nextIdx]){
				System.out.println(String.format("%04d-%04d", start[i], end[i]));
			} else {
				start[nextIdx] = start[i];
				if(end[nextIdx] < end[i]) end[nextIdx] = end[i];
			}
		}
	}
}
 

Submission Info

Submission Time
Task D - 感雨時刻の整理
User ne260037
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1619 Byte
Status AC
Exec Time 1138 ms
Memory 43148 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 357 ms 23012 KB
00_sample_02.txt AC 357 ms 23028 KB
00_sample_03.txt AC 355 ms 23080 KB
cho_cho_chokudai.txt AC 1036 ms 42832 KB
chokudai_ga_cho.txt AC 902 ms 41032 KB
test_01.txt AC 405 ms 23480 KB
test_02.txt AC 396 ms 23560 KB
test_03.txt AC 407 ms 23536 KB
test_04.txt AC 400 ms 23428 KB
test_05.txt AC 407 ms 23416 KB
test_06.txt AC 386 ms 23952 KB
test_07.txt AC 379 ms 23332 KB
test_08.txt AC 365 ms 23120 KB
test_09.txt AC 437 ms 25000 KB
test_10.txt AC 433 ms 25312 KB
test_11.txt AC 422 ms 23968 KB
test_12.txt AC 403 ms 24072 KB
test_13.txt AC 388 ms 23268 KB
test_14.txt AC 443 ms 25680 KB
test_15.txt AC 445 ms 25136 KB
test_16.txt AC 376 ms 23188 KB
test_17.txt AC 432 ms 25320 KB
test_18.txt AC 379 ms 23300 KB
test_19.txt AC 411 ms 23644 KB
test_20.txt AC 415 ms 24268 KB
test_21.txt AC 1034 ms 42180 KB
test_22.txt AC 1013 ms 42612 KB
test_23.txt AC 1058 ms 43148 KB
test_24.txt AC 1020 ms 42412 KB
test_25.txt AC 1065 ms 42516 KB
test_26.txt AC 1026 ms 42144 KB
test_27.txt AC 959 ms 40884 KB
test_28.txt AC 1138 ms 42568 KB
test_29.txt AC 373 ms 23128 KB
test_30.txt AC 381 ms 23124 KB
test_31.txt AC 690 ms 30488 KB
test_32.txt AC 373 ms 23036 KB
test_33.txt AC 1033 ms 42360 KB
test_34.txt AC 370 ms 23104 KB
test_35.txt AC 407 ms 23756 KB
test_36.txt AC 1022 ms 42452 KB
test_37.txt AC 1091 ms 41512 KB
test_38.txt AC 1017 ms 43100 KB
test_39.txt AC 1069 ms 42596 KB
test_40.txt AC 1054 ms 42404 KB
test_41.txt AC 974 ms 42884 KB
test_42.txt AC 1035 ms 42860 KB
test_43.txt AC 940 ms 41468 KB