結果
問題 | No.26 シャッフルゲーム |
ユーザー |
![]() |
提出日時 | 2015-04-03 04:32:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 163 ms / 5,000 ms |
コード長 | 964 bytes |
コンパイル時間 | 3,202 ms |
コンパイル使用メモリ | 78,396 KB |
実行使用メモリ | 54,436 KB |
最終ジャッジ日時 | 2024-07-04 01:33:41 |
合計ジャッジ時間 | 5,276 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
//No.26 シャッフルゲーム import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class No26 { static final Scanner sc = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { int[] a = new int[3]; a[sc.nextInt()-1] = 1; int m = sc.nextInt(); for (int i=0; i<m; i++) { int p = sc.nextInt()-1; int q = sc.nextInt()-1; int t = a[p]; a[p] = a[q]; a[q] = t; } for (int i=0; i<3; i++) if (a[i] == 1) out.println((i+1)); } public static void main(String[] args) { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); sc.close(); } static void trace(Object... o) { System.out.println(deepToString(o));} }