結果

問題 No.1537 私の代わりに仕事やっといてください。
ユーザー 👑 kakel-sankakel-san
提出日時 2024-06-10 21:43:06
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 1,141 bytes
コンパイル時間 11,184 ms
コンパイル使用メモリ 164,664 KB
実行使用メモリ 192,732 KB
最終ジャッジ日時 2024-06-10 21:43:26
合計ジャッジ時間 12,847 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
31,232 KB
testcase_01 AC 56 ms
31,616 KB
testcase_02 AC 186 ms
61,824 KB
testcase_03 AC 60 ms
31,488 KB
testcase_04 AC 57 ms
31,488 KB
testcase_05 AC 57 ms
31,488 KB
testcase_06 AC 59 ms
31,488 KB
testcase_07 AC 59 ms
32,000 KB
testcase_08 AC 64 ms
31,744 KB
testcase_09 AC 60 ms
32,512 KB
testcase_10 AC 69 ms
192,732 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (100 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        WriteLine(string.Join(" ", Work(n, a)));
    }
    static List<int> Work(int n, int[] _a)
    {
        var a = _a.Select((ai, id) => (ai, id)).ToList();
        a.Sort((l, r) => l.ai.CompareTo(r.ai));
        var first = new List<int>();
        var second = new List<int>();
        for (var i = 0; i < n; ++i)
        {
            if (i % 2 == 0) first.Add(a[i].id + 1);
            else second.Add(a[i].id + 1);
        }
        second.Reverse();
        first.AddRange(second);
        var pos = first.IndexOf(1);
        first = first.Skip(pos).Concat(first.Take(pos)).ToList();
        first.Add(1);
        return first;
    }
}
0