結果

問題 No.490 yukiソート
ユーザー NoNo
提出日時 2017-05-28 00:07:21
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,437 bytes
コンパイル時間 3,561 ms
コンパイル使用メモリ 116,916 KB
実行使用メモリ 42,368 KB
最終ジャッジ日時 2024-09-21 14:35:53
合計ジャッジ時間 5,643 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 14 TLE * 1 -- * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Text;
using System.Collections.Generic;
namespace Yuki
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split().Select(z => int.Parse(z)).ToArray();

            for (int i = 1; i < 2 * n - 3; i++)
            {
                var lip = new List<int>();
                var liq = new List<int>();
                for (int p = 0; p < n - 1; p++)
                {
                    bool f = true;

                    for (int q = p + 1; q < n; q++)
                    {
                        if (p + q == i)
                        {
                            lip.Add(p);
                            liq.Add(q);
                            break;
                        }
                    }
                }

                for (int j = 0; j < lip.Count; j++)
                {
                    if (a[lip[j]] > a[liq[j]])
                    {
                        int w = a[lip[j]];
                        a[lip[j]] = a[liq[j]];
                        a[liq[j]] = w;
                    }
                }
            }

            var sb = new StringBuilder();
            foreach (var item in a)
            {
                sb.Append(item.ToString() + " ");
            }

            Console.WriteLine(sb.ToString().Trim());
        }
    }
}
0