結果
問題 | No.123 カードシャッフル |
ユーザー | bayashiko_r |
提出日時 | 2018-11-30 01:14:14 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 935 bytes |
コンパイル時間 | 2,555 ms |
コンパイル使用メモリ | 98,568 KB |
実行使用メモリ | 27,956 KB |
最終ジャッジ日時 | 2023-09-09 05:57:54 |
合計ジャッジ時間 | 3,735 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
20,812 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 57 ms
18,844 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 98 ms
25,420 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; class Program { static void Main(string[] args) { //入力 string s = Console.ReadLine(); string x = Console.ReadLine(); string[] t = s.Split(' '); int N = int.Parse(t[0]); int M = int.Parse(t[1]); string[] y = x.Split(' '); int[] A = new int[M]; for (int i = 0; i < M; i++) { A[i] = int.Parse(y[i]); } var list = new List<int> { }; for (int i = 0; i < N; i++) { list.Add(N - i); } list.Add(list[A[0] - 1]); //入れ替え for (int i = 0; i < M; i++) { list.Insert(0, list[A[i] - 1]); //先頭にi番目の要素を加える list.RemoveRange(list[A[i]], 1); //先ほどまでi番目にいた数を削除する } //出力 Console.WriteLine(list[0]); } }