結果

問題 No.26 シャッフルゲーム
ユーザー soujikisoujiki
提出日時 2015-04-24 20:24:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 535 bytes
コンパイル時間 3,252 ms
コンパイル使用メモリ 72,168 KB
実行使用メモリ 56,168 KB
最終ジャッジ日時 2023-09-18 09:23:42
合計ジャッジ時間 5,446 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,848 KB
testcase_01 AC 123 ms
55,864 KB
testcase_02 AC 149 ms
55,840 KB
testcase_03 AC 135 ms
56,156 KB
testcase_04 AC 137 ms
55,716 KB
testcase_05 AC 158 ms
55,980 KB
testcase_06 AC 161 ms
55,920 KB
testcase_07 AC 139 ms
55,856 KB
testcase_08 AC 145 ms
53,264 KB
testcase_09 AC 149 ms
56,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Yukicoder_26{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		boolean[] judg = new boolean[4];
		judg[N] = true;

		for(int i=0;i<M;i++){
			int P = stdIn.nextInt();
			int Q = stdIn.nextInt();
			if(judg[P]){
				judg[P] = false;
				judg[Q] = true;
			}
			else if(judg[Q]){
				judg[P] = true;
				judg[Q] = false;
			}
		}

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