結果

問題 No.123 カードシャッフル
ユーザー huffman56huffman56
提出日時 2022-07-03 16:20:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 742 bytes
コンパイル時間 2,737 ms
コンパイル使用メモリ 102,500 KB
実行使用メモリ 28,916 KB
最終ジャッジ日時 2023-08-19 16:28:01
合計ジャッジ時間 4,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
22,008 KB
testcase_01 AC 64 ms
23,848 KB
testcase_02 AC 63 ms
21,952 KB
testcase_03 AC 64 ms
21,800 KB
testcase_04 AC 65 ms
21,852 KB
testcase_05 AC 63 ms
23,768 KB
testcase_06 AC 64 ms
21,768 KB
testcase_07 AC 64 ms
23,928 KB
testcase_08 AC 64 ms
23,960 KB
testcase_09 AC 63 ms
24,016 KB
testcase_10 AC 96 ms
28,432 KB
testcase_11 AC 122 ms
26,784 KB
testcase_12 AC 124 ms
28,916 KB
testcase_13 AC 122 ms
26,948 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;

namespace SortItems
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var chk = Console.ReadLine().Split().Select(int.Parse).ToList();
            var n = x[0];
            var m = x[1];
            var cnt = new List<int>();

            for (var i = 0; i < n; i++)
            {
                cnt.Add(i+1);
            }

            for (var i = 0; i < m; i++)
            {
                var t = cnt[chk[i] - 1];
                cnt.Remove(t);
                cnt.Insert(0, t);

            }

            Console.WriteLine(cnt[0]);

        }
    }
}
0