AtCoder Beginner Contest 001

Submission #4277303

Source codeソースコード

import java.util.*;

public class Main {
    public static void main(String[] args){

        int timeData = 0;
        int[][] times = new int[290][2];

        for (int i=0; i<290; i++){
            times[i][0] = timeData;
            timeData += 5;

            if (i != 0 && i % 12 == 0) timeData = (timeData / 100 + 1) * 100;
        }

        // input
        Scanner sc = new Scanner(System.in);
        int inputCount = sc.nextInt();
        for (int i=0; i<inputCount; i++) {
            String[] lainTime = sc.next().split("-");
            int from = Integer.valueOf(lainTime[0]);
            int to =Integer.valueOf(lainTime[1]);

            // 丸め
            from = from - from % 5;
            if (5 - to % 5 != 5) {
                to = to + (5 - to % 5);
            }

            for (int j=0; j<290; j++){
                if (times[j][1] == 1) continue;
                if (times[j][0] >= from && times[j][0] <= to) times[j][1] = 1;
            }
        }

        // output
        ArrayList<String> resultList = new ArrayList<>();
        String result = "";
        boolean isContinue = false;

        for (int i=0; i<times.length; i++) {

            if(isContinue) {
                if (times[i][1] == 0) {
                    isContinue = false;
                    String intResult = Integer.toString(times[i-1][0]);
                    result += "-" + intResult.substring(intResult.length()-4);
                    resultList.add(result);
                    result = "";
                }
            }
            else {
                if (times[i][1] == 1) {
                    isContinue = true;
                    result = "0000" + (times[i][0]);
                    result = result.substring(result.length()-4);
                }
            }

            if (isContinue && i==289) {
                result += "-2400";
                resultList.add(result);
            }
        }

        for (String output : resultList) {
            System.out.println(output);
        }
    }
}

Submission

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

Test case

Set

Set name Score得点 / Max score Cases
all 0 / 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 96 ms 21844 KB
00_sample_02.txt AC 95 ms 19924 KB
00_sample_03.txt WA
cho_cho_chokudai.txt WA
chokudai_ga_cho.txt AC 366 ms 40828 KB
test_01.txt RE
test_02.txt RE
test_03.txt RE
test_04.txt RE
test_05.txt RE
test_06.txt AC 115 ms 19796 KB
test_07.txt AC 107 ms 19796 KB
test_08.txt AC 105 ms 21844 KB
test_09.txt AC 125 ms 20180 KB
test_10.txt AC 131 ms 17620 KB
test_11.txt RE
test_12.txt AC 140 ms 21716 KB
test_13.txt AC 109 ms 23892 KB
test_14.txt AC 136 ms 20308 KB
test_15.txt AC 128 ms 21204 KB
test_16.txt RE
test_17.txt AC 124 ms 22228 KB
test_18.txt AC 122 ms 17364 KB
test_19.txt AC 133 ms 18900 KB
test_20.txt AC 139 ms 21456 KB
test_21.txt AC 382 ms 39640 KB
test_22.txt AC 313 ms 40904 KB
test_23.txt AC 365 ms 38240 KB
test_24.txt AC 380 ms 41424 KB
test_25.txt AC 375 ms 40940 KB
test_26.txt WA
test_27.txt RE
test_28.txt RE
test_29.txt AC 96 ms 21332 KB
test_30.txt RE
test_31.txt RE
test_32.txt RE
test_33.txt WA
test_34.txt RE
test_35.txt RE
test_36.txt AC 375 ms 38388 KB
test_37.txt RE
test_38.txt WA
test_39.txt RE
test_40.txt RE
test_41.txt AC 317 ms 42760 KB
test_42.txt AC 363 ms 41444 KB
test_43.txt AC 396 ms 41020 KB