結果

問題 No.205 マージして辞書順最小
ユーザー mbanmban
提出日時 2017-06-26 19:33:59
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,170 bytes
コンパイル時間 894 ms
コンパイル使用メモリ 111,204 KB
実行使用メモリ 24,648 KB
最終ジャッジ日時 2024-04-15 01:55:48
合計ジャッジ時間 3,030 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
17,664 KB
testcase_01 AC 24 ms
17,792 KB
testcase_02 RE -
testcase_03 AC 76 ms
19,584 KB
testcase_04 AC 64 ms
19,456 KB
testcase_05 AC 65 ms
19,712 KB
testcase_06 RE -
testcase_07 AC 150 ms
22,400 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 114 ms
22,784 KB
testcase_11 AC 168 ms
22,272 KB
testcase_12 AC 147 ms
22,400 KB
testcase_13 AC 112 ms
22,528 KB
testcase_14 RE -
testcase_15 AC 25 ms
17,664 KB
testcase_16 AC 29 ms
18,432 KB
testcase_17 AC 28 ms
18,432 KB
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int N;
    private string[] S;
    private int Length = 0;

    private void Scan()
    {
        N = int.Parse(Console.ReadLine());
        S = new string[N];
        for (int i = 0; i < N; i++)
        {
            string line = Console.ReadLine();
            Length += line.Length;
            S[i] = line + (char)255;
        }
    }

    public void Solve()
    {
        Scan();
        string ans = "";
        for (int i = 0; i < Length; i++)
        {
            int index = 0;
            string min = S[0];
            for (int j = 1; j < N; j++)
            {
                if (min.CompareTo(S[j]) > 0)
                {
                    min = S[j];
                    index = j;
                }
            }
            ans += min[0];
            S[index] = min.Substring(1);
        }
        Console.WriteLine(ans);
    }
}
0