結果

問題 No.26 シャッフルゲーム
ユーザー lrf141lrf141
提出日時 2016-12-01 14:06:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 182 ms / 5,000 ms
コード長 644 bytes
コンパイル時間 3,625 ms
コンパイル使用メモリ 72,308 KB
実行使用メモリ 56,440 KB
最終ジャッジ日時 2023-08-18 11:17:23
合計ジャッジ時間 6,203 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,788 KB
testcase_01 AC 131 ms
55,796 KB
testcase_02 AC 170 ms
55,844 KB
testcase_03 AC 141 ms
55,772 KB
testcase_04 AC 144 ms
56,440 KB
testcase_05 AC 171 ms
55,704 KB
testcase_06 AC 160 ms
55,900 KB
testcase_07 AC 145 ms
55,588 KB
testcase_08 AC 160 ms
55,948 KB
testcase_09 AC 182 ms
56,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class no26{
    public static void main(String... args){
        
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(),m = scan.nextInt(),p,q,tmp;
        int res[] = new int[3];
        res[n-1]++;

        for(int i = 0; i < m; i++){
            p = scan.nextInt();
            q = scan.nextInt();
            p--;
            q--;
            tmp = res[p];
            res[p] = res[q];
            res[q] = tmp;
        }

        for(int i = 0; i < 3; i++){
            if(res[i] == 1){
                System.out.println(i+1);
                break;
            }
        }
    }
}
0