結果
| 問題 | No.26 シャッフルゲーム |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-11-10 10:04:54 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 5,000 ms |
| コード長 | 647 bytes |
| 記録 | |
| コンパイル時間 | 1,692 ms |
| コンパイル使用メモリ | 82,148 KB |
| 実行使用メモリ | 47,744 KB |
| 最終ジャッジ日時 | 2026-04-03 10:10:57 |
| 合計ジャッジ時間 | 3,072 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
boolean[] hasBall = new boolean[4];
hasBall[sc.nextInt()] = true;
int m = sc.nextInt();
for (int i = 0; i < m; i++) {
int left = sc.nextInt();
int right = sc.nextInt();
boolean tmp = hasBall[left];
hasBall[left] = hasBall[right];
hasBall[right] = tmp;
}
for (int i = 1; i < 4; i++) {
if (hasBall[i]) {
System.out.println(i);
return;
}
}
}
}
tenten