結果

問題 No.26 シャッフルゲーム
ユーザー kmtrc130kmtrc130
提出日時 2019-03-18 15:14:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 708 bytes
コンパイル時間 3,412 ms
コンパイル使用メモリ 105,196 KB
実行使用メモリ 21,652 KB
最終ジャッジ日時 2023-09-25 12:14:14
合計ジャッジ時間 4,420 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,580 KB
testcase_01 AC 61 ms
21,592 KB
testcase_02 AC 61 ms
21,652 KB
testcase_03 AC 61 ms
21,636 KB
testcase_04 AC 62 ms
21,596 KB
testcase_05 AC 63 ms
21,620 KB
testcase_06 AC 61 ms
21,556 KB
testcase_07 AC 63 ms
21,624 KB
testcase_08 AC 61 ms
19,508 KB
testcase_09 AC 61 ms
21,532 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.Linq;

class Program
{
    public void Solve()
    {
        string[] cup = new string[3];

        int N = int.Parse(Console.ReadLine());
        cup[N - 1] = "○";

        int M = int.Parse(Console.ReadLine());
        string taihi = "";
        int[] PQ;
        for (int i = 0; i < M; i++)
        {
            PQ = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            taihi = cup[PQ[0] - 1];
            cup[PQ[0] - 1] = cup[PQ[1] - 1];
            cup[PQ[1] - 1] = taihi;
        }

        Console.WriteLine(Array.IndexOf(cup, "○") + 1);
    }

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