結果

問題 No.26 シャッフルゲーム
ユーザー kano_townkano_town
提出日時 2014-11-21 17:26:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 163 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 4,888 ms
コンパイル使用メモリ 71,716 KB
実行使用メモリ 56,288 KB
最終ジャッジ日時 2023-08-30 22:09:46
合計ジャッジ時間 7,141 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,532 KB
testcase_01 AC 125 ms
55,764 KB
testcase_02 AC 163 ms
55,740 KB
testcase_03 AC 130 ms
55,576 KB
testcase_04 AC 145 ms
55,624 KB
testcase_05 AC 145 ms
55,836 KB
testcase_06 AC 143 ms
55,628 KB
testcase_07 AC 135 ms
55,796 KB
testcase_08 AC 145 ms
56,100 KB
testcase_09 AC 145 ms
56,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukicoder26 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int P, Q;
		boolean[] cup = {false, false, false};
		cup[N - 1] = true;

		for (int i = 0; i < M; i++) {
			P = sc.nextInt();
			Q = sc.nextInt();
			cup[P - 1] ^= cup[Q - 1];
			cup[Q - 1] ^= cup[P - 1];
			cup[P - 1] ^= cup[Q - 1];
		}
		
		for (int i = 0; i < 3; i++)
			if (cup[i])
				System.out.println(i + 1);

	}
}
0