AtCoder Beginner Contest 001

Submission #108366

Source codeソースコード

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) throws java.io.IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String[] ia;
		//Scanner in = new Scanner(System.in);

		boolean[] rain = new boolean[24*60/5];

		int n = Integer.parseInt(in.readLine());
		for(int i = 0;i < n; ++i){
			ia = in.readLine().split("-");
			int a = Integer.parseInt(ia[0]);
			int begin = a/100*12 + a%100/5;
			int b = Integer.parseInt(ia[1]);
			int end   = b/100*12 + b%100/5;
			if(b%5 == 0){
				--end;
			}
			for(int j = begin;j <= end; ++j){
				rain[j] = true;
			}
		}
		boolean cont = false;
		for(int i = 0;i < 24*60/5; ++i){
			if(rain[i]){
				if(!cont){
					cont = true;
					System.out.print(String.format("%02d%02d", i/12, i%12*5)); 
				} else {
				}
			} else {
				if(cont){
					cont = false;
					System.out.println(String.format("-%02d%02d", i/12, i%12*5)); 
				}
			}
		}
		if(cont){
			System.out.println("-2400");
		}
	}
}

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 KHe7
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 1089 Byte
File nameファイル名
Exec time実行時間 726 ms
Memory usageメモリ使用量 33768 KB

Test case

Set

Set name Score得点 / Max score Cases
all 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 434 ms 21296 KB
00_sample_02.txt AC 425 ms 21304 KB
00_sample_03.txt AC 439 ms 21268 KB
cho_cho_chokudai.txt AC 673 ms 33256 KB
chokudai_ga_cho.txt AC 695 ms 32672 KB
test_01.txt AC 484 ms 22688 KB
test_02.txt AC 482 ms 22708 KB
test_03.txt AC 492 ms 22832 KB
test_04.txt AC 474 ms 22708 KB
test_05.txt AC 491 ms 22712 KB
test_06.txt AC 431 ms 22864 KB
test_07.txt AC 439 ms 22740 KB
test_08.txt AC 459 ms 22836 KB
test_09.txt AC 448 ms 22992 KB
test_10.txt AC 459 ms 22996 KB
test_11.txt AC 451 ms 23248 KB
test_12.txt AC 442 ms 23092 KB
test_13.txt AC 441 ms 21304 KB
test_14.txt AC 455 ms 23084 KB
test_15.txt AC 463 ms 23208 KB
test_16.txt AC 442 ms 21296 KB
test_17.txt AC 457 ms 23092 KB
test_18.txt AC 432 ms 21288 KB
test_19.txt AC 450 ms 23096 KB
test_20.txt AC 449 ms 22172 KB
test_21.txt AC 683 ms 32528 KB
test_22.txt AC 674 ms 32320 KB
test_23.txt AC 685 ms 33768 KB
test_24.txt AC 672 ms 33456 KB
test_25.txt AC 657 ms 33472 KB
test_26.txt AC 659 ms 32132 KB
test_27.txt AC 686 ms 33180 KB
test_28.txt AC 687 ms 33004 KB
test_29.txt AC 433 ms 21296 KB
test_30.txt AC 443 ms 21300 KB
test_31.txt AC 543 ms 26240 KB
test_32.txt AC 442 ms 21308 KB
test_33.txt AC 726 ms 33516 KB
test_34.txt AC 437 ms 21300 KB
test_35.txt AC 603 ms 21428 KB
test_36.txt AC 657 ms 33632 KB
test_37.txt AC 693 ms 33672 KB
test_38.txt AC 675 ms 33756 KB
test_39.txt AC 663 ms 33440 KB
test_40.txt AC 687 ms 32872 KB
test_41.txt AC 661 ms 32160 KB
test_42.txt AC 656 ms 33148 KB
test_43.txt AC 682 ms 32896 KB