結果
| 問題 |
No.123 カードシャッフル
|
| コンテスト | |
| ユーザー |
pirorirori_n712
|
| 提出日時 | 2018-09-25 23:09:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 725 bytes |
| コンパイル時間 | 2,740 ms |
| コンパイル使用メモリ | 106,880 KB |
| 実行使用メモリ | 26,240 KB |
| 最終ジャッジ日時 | 2024-10-06 18:14:37 |
| 合計ジャッジ時間 | 2,256 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 4 WA * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Linq;
using System.Collections.Generic;
class No123
{
static void Main()
{
var num = Console.ReadLine().Split(' ').Select(x => (Int32.Parse(x))).ToArray();
var list = Enumerable.Repeat(-1, num[0]).ToList();
var index = Console.ReadLine().Split(' ').Select(x => (Int32.Parse(x))).ToArray();
var length = index.Length;
for (int i = 0; i < length; ++i)
{
if (list[index[i]-1] == -1) list.Add(index[i]);
else
{
var n = list[index[i]-1];
list.Remove(n);
list.Add(n);
}
}
Console.WriteLine(list.Last() != -1 ? list.Last() : 1);
}
}
pirorirori_n712