結果

問題 No.123 カードシャッフル
ユーザー kmtrc130kmtrc130
提出日時 2019-03-18 16:46:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 107 ms / 5,000 ms
コード長 674 bytes
コンパイル時間 3,778 ms
コンパイル使用メモリ 104,100 KB
実行使用メモリ 28,972 KB
最終ジャッジ日時 2023-09-25 14:22:55
合計ジャッジ時間 4,318 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
23,860 KB
testcase_01 AC 61 ms
21,852 KB
testcase_02 AC 61 ms
21,860 KB
testcase_03 AC 60 ms
19,912 KB
testcase_04 AC 61 ms
21,724 KB
testcase_05 AC 60 ms
21,780 KB
testcase_06 AC 60 ms
23,832 KB
testcase_07 AC 60 ms
21,776 KB
testcase_08 AC 60 ms
21,820 KB
testcase_09 AC 60 ms
21,904 KB
testcase_10 AC 96 ms
28,492 KB
testcase_11 AC 97 ms
28,972 KB
testcase_12 AC 107 ms
26,864 KB
testcase_13 AC 105 ms
26,860 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;

class Program
{
    public void Solve()
    {
        int[] NM = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        List<int> cards = new List<int>();
        for (int i = 0; i < NM[0]; i++) { cards.Add(i + 1); }

        for (int i = 0; i < NM[1]; i++)
        {
            cards.Insert(0, cards[A[i] - 1]);
            cards.RemoveAt(A[i]);
        }

        Console.WriteLine(cards[0]);
    }

    static void Main()
    {
        var solver = new Program();
        solver.Solve();
    }
}
0