Submission #114874


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        int hour = 12;
        int day = hour * 24+1;
        //1000
        //   0    1    2    3    4    5    6    7    8    9   10   11   12   13
        //0000 0005 0010 0015 0020 0025 0030 0035 0040 0045 0050 0055 0100 0105
        // (dayArray[i])?i/12 = getHour  (dayArray[i]%12)*5 = getMinute
        int[] dayArray = new int[day];
        int N = int.Parse(Console.ReadLine());
        for (int i = 0; i < N; i++)
        {
            var rainningTimesListay = Console.ReadLine().Split('-').Select(int.Parse).ToArray();
            int s = rainningTimesListay.ElementAtOrDefault(0);
            int e = rainningTimesListay.ElementAtOrDefault(1);
            int s1 = int.Parse(s.ToString()[s.ToString().Length - 1].ToString());
            if (s1 == 0) { }
            else if (s1 < 5)
                s -= s1;
            else if (s1 > 5) s -= s1 - 5;
            int e1 = int.Parse(e.ToString()[e.ToString().Length - 1].ToString());

            if (e1 == 0) { }
            else if (e1 < 5)
                e += 5 - e1;
            else if (e1 > 5) e += 10 - e1;

            int startIndex = GetIndex(s.ToString().PadLeft(4, '0'));
            int endIndex = GetIndex(e.ToString().PadLeft(4, '0'));
            dayArray[startIndex]++;
            dayArray[endIndex]--;
        }
        for (int i = 0; i < dayArray.Length; i++)
        {
            int temp = 0;
            int start = -1 , end = -1;
            if (dayArray[i]>0)
            {
                temp += dayArray[i];
                start = GetHour(i) * 100 + GetMinute(i);
                while (temp > 0) { i++; if (i == 289)break; temp += dayArray[i]; }
                end = GetHour(i) * 100 + GetMinute(i);
                Console.WriteLine(start.ToString().PadLeft(4, '0') + "-" + end.ToString().PadLeft(4, '0'));
            }
        }
    }
    static int GetIndex(string input)
    {
        int hour = (int.Parse(input.Substring(0, 2)) * 12);
        int minute = (int.Parse(input.Substring(2, 2)) / 5);
        return  hour+minute ;
    }
    static int GetHour(int i)
    {
        return i / 12;
    }
    static int GetMinute(int i)
    {
        return i % 12 * 5;
    }
}

Submission Info

Submission Time
Task D - 感雨時刻の整理
User pattyo
Language C# (Mono 2.10.8.1)
Score 100
Code Size 2385 Byte
Status AC
Exec Time 312 ms
Memory 8960 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 158 ms 8636 KB
00_sample_02.txt AC 157 ms 8636 KB
00_sample_03.txt AC 151 ms 8632 KB
cho_cho_chokudai.txt AC 294 ms 8820 KB
chokudai_ga_cho.txt AC 288 ms 8892 KB
test_01.txt AC 155 ms 8764 KB
test_02.txt AC 158 ms 8760 KB
test_03.txt AC 156 ms 8768 KB
test_04.txt AC 158 ms 8764 KB
test_05.txt AC 159 ms 8768 KB
test_06.txt AC 171 ms 8740 KB
test_07.txt AC 162 ms 8696 KB
test_08.txt AC 159 ms 8688 KB
test_09.txt AC 159 ms 8884 KB
test_10.txt AC 156 ms 8836 KB
test_11.txt AC 161 ms 8820 KB
test_12.txt AC 160 ms 8888 KB
test_13.txt AC 154 ms 8772 KB
test_14.txt AC 158 ms 8840 KB
test_15.txt AC 159 ms 8836 KB
test_16.txt AC 154 ms 8756 KB
test_17.txt AC 159 ms 8836 KB
test_18.txt AC 156 ms 8764 KB
test_19.txt AC 156 ms 8832 KB
test_20.txt AC 167 ms 8836 KB
test_21.txt AC 290 ms 8892 KB
test_22.txt AC 286 ms 8960 KB
test_23.txt AC 290 ms 8852 KB
test_24.txt AC 281 ms 8844 KB
test_25.txt AC 296 ms 8836 KB
test_26.txt AC 293 ms 8884 KB
test_27.txt AC 294 ms 8820 KB
test_28.txt AC 291 ms 8828 KB
test_29.txt AC 152 ms 8632 KB
test_30.txt AC 160 ms 8624 KB
test_31.txt AC 174 ms 8888 KB
test_32.txt AC 156 ms 8660 KB
test_33.txt AC 247 ms 8872 KB
test_34.txt AC 153 ms 8632 KB
test_35.txt AC 155 ms 8772 KB
test_36.txt AC 292 ms 8836 KB
test_37.txt AC 297 ms 8836 KB
test_38.txt AC 295 ms 8836 KB
test_39.txt AC 293 ms 8840 KB
test_40.txt AC 312 ms 8900 KB
test_41.txt AC 302 ms 8892 KB
test_42.txt AC 300 ms 8956 KB
test_43.txt AC 301 ms 8880 KB