結果

問題 No.26 シャッフルゲーム
ユーザー atkrymatkrym
提出日時 2016-11-07 18:16:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 163 ms / 5,000 ms
コード長 574 bytes
コンパイル時間 3,455 ms
コンパイル使用メモリ 71,632 KB
実行使用メモリ 56,340 KB
最終ジャッジ日時 2023-08-16 14:38:09
合計ジャッジ時間 4,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,800 KB
testcase_01 AC 119 ms
55,796 KB
testcase_02 AC 163 ms
54,120 KB
testcase_03 AC 131 ms
55,808 KB
testcase_04 AC 133 ms
55,432 KB
testcase_05 AC 148 ms
55,596 KB
testcase_06 AC 144 ms
56,340 KB
testcase_07 AC 133 ms
56,316 KB
testcase_08 AC 141 ms
55,632 KB
testcase_09 AC 144 ms
55,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        boolean[] b = new boolean[4];
        int n = sc.nextInt();
        b[n] = true;
        int m = sc.nextInt();
        for (int i = 0;i < m;i++) {
            int p = sc.nextInt();
            int q = sc.nextInt();
            boolean tmp = b[p];
            b[p] = b[q];
            b[q] = tmp;
        }
        for (int i = 1;i <= 3;i++) {
            if (b[i]) System.out.println(i);
        }
    }
}

0