結果

問題 No.365 ジェンガソート
ユーザー mori_chibimori_chibi
提出日時 2017-08-21 13:41:08
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,429 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 112,384 KB
実行使用メモリ 37,104 KB
最終ジャッジ日時 2024-04-23 01:34:36
合計ジャッジ時間 4,895 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
34,204 KB
testcase_01 AC 25 ms
25,124 KB
testcase_02 AC 25 ms
24,964 KB
testcase_03 AC 24 ms
27,164 KB
testcase_04 AC 23 ms
25,264 KB
testcase_05 AC 24 ms
25,504 KB
testcase_06 AC 24 ms
27,164 KB
testcase_07 AC 23 ms
25,380 KB
testcase_08 AC 24 ms
25,136 KB
testcase_09 AC 26 ms
25,248 KB
testcase_10 AC 25 ms
25,212 KB
testcase_11 AC 28 ms
25,116 KB
testcase_12 AC 27 ms
25,264 KB
testcase_13 AC 28 ms
25,008 KB
testcase_14 AC 27 ms
27,292 KB
testcase_15 AC 27 ms
25,396 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

namespace GengaSort
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] An = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            if (N > An.Length) N = An.Length;
            int[] Xn = new int[N];
            int ix = 0, count = 0, max = 0;
            while(ix > -1)
            {
                ix = -1;
                max = 0;
                for (int i = 0; i < An.Length - 1; i++)
                {
                    if (An[i] > max) max = An[i];
                    if (max > An[i + 1] && (ix == -1 || An[ix] < An[i + 1])) ix = i + 1;
                }
                if (ix > -1)
                {
                    count++;
                    for (int i = 0; i < An.Length; i++)
                    {
                        if (i == ix)
                        {
                            Xn[0] = An[i];
                        }
                        else if (i < ix)
                        {
                            Xn[i + 1] = An[i];
                        }
                        else
                        {
                            Xn[i] = An[i];
                        }
                    }
                    Array.Copy(Xn, An, Xn.Length);
                }
            }
            Console.WriteLine(count);
        }
    }
}
0