結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー Mishan5055Mishan5055
提出日時 2020-02-27 14:12:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,297 bytes
コンパイル時間 2,076 ms
コンパイル使用メモリ 76,660 KB
実行使用メモリ 752,696 KB
最終ジャッジ日時 2024-04-21 16:57:05
合計ジャッジ時間 19,390 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
40,028 KB
testcase_01 AC 112 ms
41,096 KB
testcase_02 AC 102 ms
40,004 KB
testcase_03 AC 117 ms
41,544 KB
testcase_04 AC 116 ms
41,208 KB
testcase_05 AC 121 ms
41,468 KB
testcase_06 AC 123 ms
41,296 KB
testcase_07 AC 125 ms
41,140 KB
testcase_08 AC 128 ms
41,480 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 130 ms
41,432 KB
testcase_12 AC 133 ms
41,584 KB
testcase_13 AC 1,418 ms
463,096 KB
testcase_14 AC 1,381 ms
463,820 KB
testcase_15 AC 1,608 ms
463,488 KB
testcase_16 AC 1,327 ms
463,724 KB
testcase_17 AC 1,376 ms
464,028 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[][] ROOT=new int[N][N];
        int[] X=new int[N-1];
        int[] Y=new int[N-1];
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                ROOT[i][j]=0;
            }
            ROOT[i][i]=1;
        }
        
        for(int i=0;i<N-1;i++){
            int tmp_start=sc.nextInt();
            int tmp_goal=sc.nextInt();
            for(int j=0;j<N;j++){
                if(ROOT[tmp_goal][j]==1){
                    ROOT[tmp_start][j]=1;
                }
                if(ROOT[tmp_start][j]==1){
                    ROOT[tmp_goal][j]=1;
                }
                if(ROOT[tmp_start][j]==1){
                    ROOT[j][tmp_start]=1;
                }
                if(ROOT[tmp_goal][j]==1){
                    ROOT[j][tmp_goal]=1;
                }
            }
        }
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(ROOT[i][j]==0){
                    System.out.println("Alice");
                    return;
                }
            }
        }
        
        System.out.println("Bob");
        
    }
}
0