AtCoder Beginner Contest 001

Submission #296081

Source codeソースコード

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

class Program
{
    static void Main(string[] args)
    {
        Solver solver = new Solver();
        solver.solve();
        return;
    }
}

class Solver
{
    public void solve()
    {
        int n = ri();
        List<Tuple<int, int>> RT = new List<Tuple<int, int>>();
        List<Tuple<int, int>> result = new List<Tuple<int, int>>();
        
        for (int i = 0; i < n; i++)
        {
            var tmp = ria('-');
            RT.Add(new Tuple<int, int>(timeDowner(tmp[0]), timeUpper(tmp[1])));
        }

        if (n == 1)
        {
            Console.WriteLine("{0:D4}" + "-" + "{1:D4}", RT[0].Item1, RT[0].Item2);
            return;
        }

        var  minOrder = RT.OrderBy(x => x.Item1).ToArray();

        int startTime = 0;
        int endTime = 0;

        foreach (var obj in minOrder)
        {
            if (Math.Max(obj.Item1, endTime) == endTime)
            {
                endTime = Math.Max(obj.Item2, endTime);
            }
            else
            {
                result.Add(new Tuple<int, int>(startTime, endTime));
                startTime = obj.Item1;
                endTime = obj.Item2;
            }
        }
        result.Add(new Tuple<int, int>(startTime, endTime));

        var ar = result.Skip(1).ToArray();

        foreach (var obj in ar)
            Console.WriteLine("{0:D4}" + "-" + "{1:D4}",obj.Item1 ,obj.Item2);
    }

    private int timeUpper(int num)
    {
        int tmp = (num % 10) - 5;
        if (tmp == 0 || tmp == -5)
        {
            return num;
        }
        else if (tmp > 0)
        {
            num += (5 - tmp);
            if (num % 100 == 60)
            {
                num += 100 - 60;
            }
        }
        else
        {
            return num -= tmp;
        }
        return num;
    }

    private int timeDowner(int num)
    {
        int tmp = (num % 10) - 5;
        if (tmp == -5)
        {
            return num;
        }
        else
        {
            if (tmp > 0)
                return num - tmp;
            else
                return num - (5 + tmp);
        }
    }

    static String rs() { return Console.ReadLine(); }
    static int ri() { return int.Parse(Console.ReadLine()); }
    static long rl() { return long.Parse(Console.ReadLine()); }
    static double rd() { return double.Parse(Console.ReadLine()); }
    static String[] rsa() { return Console.ReadLine().Split(' '); }
    static int[] ria() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e)); }
    static int[] ria(char split) { return Array.ConvertAll(Console.ReadLine().Split(split), e => int.Parse(e)); }
    static long[] rla() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e)); }
    static double[] rda() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e)); }
    static double rounding(double target, int rank) { return Math.Round(target, rank, MidpointRounding.AwayFromZero); }
}

Submission

Task問題 D - 感雨時刻の整理
User nameユーザ名 yamachuco
Created time投稿日時
Language言語 C# (Mono 2.10.8.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 3173 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 143 ms 6748 KB
00_sample_02.txt AC 122 ms 6100 KB
00_sample_03.txt WA
cho_cho_chokudai.txt WA
chokudai_ga_cho.txt WA
test_01.txt WA
test_02.txt WA
test_03.txt WA
test_04.txt WA
test_05.txt WA
test_06.txt WA
test_07.txt WA
test_08.txt WA
test_09.txt WA
test_10.txt WA
test_11.txt WA
test_12.txt WA
test_13.txt WA
test_14.txt WA
test_15.txt WA
test_16.txt AC 143 ms 6752 KB
test_17.txt AC 146 ms 6752 KB
test_18.txt AC 146 ms 6728 KB
test_19.txt AC 148 ms 6820 KB
test_20.txt AC 143 ms 6852 KB
test_21.txt WA
test_22.txt WA
test_23.txt WA
test_24.txt WA
test_25.txt WA
test_26.txt WA
test_27.txt AC 207 ms 9380 KB
test_28.txt WA
test_29.txt AC 121 ms 6100 KB
test_30.txt WA
test_31.txt WA
test_32.txt WA
test_33.txt WA
test_34.txt AC 143 ms 6676 KB
test_35.txt WA
test_36.txt AC 222 ms 9268 KB
test_37.txt WA
test_38.txt WA
test_39.txt AC 205 ms 9304 KB
test_40.txt WA
test_41.txt WA
test_42.txt WA
test_43.txt WA