結果

問題 No.26 シャッフルゲーム
コンテスト
ユーザー lrf141
提出日時 2016-12-01 14:06:06
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 76 ms / 5,000 ms
+ 745µs
コード長 644 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,208 ms
コンパイル使用メモリ 85,676 KB
実行使用メモリ 46,524 KB
最終ジャッジ日時 2026-09-30 22:39:55
合計ジャッジ時間 4,555 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;
public class no26{
    public static void main(String... args){
        
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(),m = scan.nextInt(),p,q,tmp;
        int res[] = new int[3];
        res[n-1]++;

        for(int i = 0; i < m; i++){
            p = scan.nextInt();
            q = scan.nextInt();
            p--;
            q--;
            tmp = res[p];
            res[p] = res[q];
            res[q] = tmp;
        }

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