結果

問題 No.26 シャッフルゲーム
ユーザー aikon_marimoaikon_marimo
提出日時 2018-05-07 21:10:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 167 ms / 5,000 ms
コード長 523 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 70,996 KB
実行使用メモリ 56,240 KB
最終ジャッジ日時 2023-09-10 10:56:56
合計ジャッジ時間 4,161 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,240 KB
testcase_01 AC 121 ms
56,188 KB
testcase_02 AC 167 ms
55,996 KB
testcase_03 AC 133 ms
55,992 KB
testcase_04 AC 138 ms
55,800 KB
testcase_05 AC 146 ms
55,816 KB
testcase_06 AC 145 ms
56,088 KB
testcase_07 AC 137 ms
56,032 KB
testcase_08 AC 146 ms
56,168 KB
testcase_09 AC 164 ms
55,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		int M = in.nextInt();
		boolean flg[] = new boolean[3];
		flg[N-1] = true;
		for (int i = 0; i < M; i++) {
			int p, q;
			p = in.nextInt();
			q = in.nextInt();
			boolean tmp = flg[p-1];
			flg[p-1] = flg[q-1];
			flg[q-1] = tmp;
		}
		for (int i = 0; i < 3; i++) {
			if (flg[i]) {
				System.out.println(i+1);
				break;
			}
		}
	}
}
0