結果

問題 No.26 シャッフルゲーム
ユーザー curryudon08curryudon08
提出日時 2020-06-22 16:46:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 3,181 ms
コンパイル使用メモリ 104,076 KB
実行使用メモリ 23,756 KB
最終ジャッジ日時 2023-09-16 19:14:50
合計ジャッジ時間 4,709 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,724 KB
testcase_01 AC 58 ms
21,576 KB
testcase_02 AC 60 ms
21,640 KB
testcase_03 AC 59 ms
23,700 KB
testcase_04 AC 58 ms
23,708 KB
testcase_05 AC 59 ms
23,668 KB
testcase_06 AC 59 ms
21,572 KB
testcase_07 AC 58 ms
23,756 KB
testcase_08 AC 58 ms
23,716 KB
testcase_09 AC 58 ms
21,660 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;

namespace _0026
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var cup = new int[3];
            cup[n-1] = 1;

            var m = int.Parse(Console.ReadLine());
            for(var i = 0; i < m; i++){
                var t = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                var idx1 = t[0] - 1;
                var idx2 = t[1] - 1;

                var tmp = cup[idx1];
                cup[idx1] = cup[idx2];
                cup[idx2] = tmp;
            }

            for(var i = 0; i < 3; i++){
                if(cup[i] == 1){
                    Console.WriteLine(i + 1);
                }
            }
        }
    }
}
0