結果
| 問題 | No.26 シャッフルゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-29 14:49:07 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 5,000 ms |
| コード長 | 636 bytes |
| 記録 | |
| コンパイル時間 | 4,604 ms |
| コンパイル使用メモリ | 108,416 KB |
| 実行使用メモリ | 20,096 KB |
| 最終ジャッジ日時 | 2026-05-22 14:39:21 |
| 合計ジャッジ時間 | 5,944 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 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;
class Program
{
static void Main()
{
bool[] cup = new bool[3];
cup[int.Parse(Console.ReadLine()) - 1] = true;
int n = int.Parse(Console.ReadLine());
for(int i = 0; i < n; i++)
{
int[] change = Console.ReadLine().Split().Select(a => int.Parse(a) - 1).ToArray();
bool temp = cup[change[0]];
cup[change[0]] = cup[change[1]];
cup[change[1]] = temp;
}
Console.WriteLine($"{cup.Select((a, i) => new {Content = a, Index = i}).Where(a => a.Content).Select(a => a.Index + 1).ToArray()[0]}");
}
}