結果
| 問題 |
No.123 カードシャッフル
|
| コンテスト | |
| ユーザー |
pirorirori_n712
|
| 提出日時 | 2018-09-25 23:00:33 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 722 bytes |
| コンパイル時間 | 1,850 ms |
| コンパイル使用メモリ | 111,192 KB |
| 実行使用メモリ | 30,900 KB |
| 最終ジャッジ日時 | 2024-10-06 17:04:55 |
| 合計ジャッジ時間 | 2,203 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 4 |
| other | RE * 10 |
コンパイルメッセージ
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 index = Console.ReadLine().Split(' ').Select(x => (Int32.Parse(x))).ToArray();
var length = index.Length;
var list = Enumerable.Repeat(-1, length).ToList();
for (int i = 0; i < length; ++i)
{
if (list[index[i-1]] == -1) list.Add(i + 1);
else
{
var n = list[index[i-1]];
list.Remove(n);
list.Add(n);
}
}
Console.WriteLine(list.Last() != -1 ? list.Last() : 1);
}
}
pirorirori_n712