結果
問題 | No.26 シャッフルゲーム |
ユーザー | yun_app |
提出日時 | 2016-05-09 21:36:09 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 49 ms / 5,000 ms |
コード長 | 1,120 bytes |
コンパイル時間 | 4,925 ms |
コンパイル使用メモリ | 77,248 KB |
実行使用メモリ | 49,680 KB |
最終ジャッジ日時 | 2023-07-28 05:21:15 |
合計ジャッジ時間 | 5,535 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
49,444 KB |
testcase_01 | AC | 44 ms
49,200 KB |
testcase_02 | AC | 49 ms
49,436 KB |
testcase_03 | AC | 45 ms
49,232 KB |
testcase_04 | AC | 46 ms
49,192 KB |
testcase_05 | AC | 48 ms
49,180 KB |
testcase_06 | AC | 47 ms
49,308 KB |
testcase_07 | AC | 46 ms
49,148 KB |
testcase_08 | AC | 48 ms
49,288 KB |
testcase_09 | AC | 49 ms
49,680 KB |
ソースコード
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int m = Integer.parseInt(br.readLine()); HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); map.put(1,0); map.put(2,0); map.put(3,0); map.put(n,1); //nに1を置く for(int i=0;i<m;i++){ String[] lines = br.readLine().split(" "); int a = Integer.parseInt(lines[0]); int b = Integer.parseInt(lines[1]); int tmp = map.get(a); map.put(a,map.get(b)); map.put(b,tmp); } for(int i=1;i<=3;i++){ if(map.get(i)==1){ System.out.println(i); break; } } } }