結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー mino_yellowmino_yellow
提出日時 2022-11-16 01:03:08
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 32,784 KB
実行使用メモリ 59,348 KB
最終ジャッジ日時 2023-10-16 23:46:18
合計ジャッジ時間 3,793 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
32,876 KB
testcase_01 AC 42 ms
32,876 KB
testcase_02 AC 42 ms
32,876 KB
testcase_03 AC 43 ms
32,876 KB
testcase_04 AC 42 ms
32,876 KB
testcase_05 AC 41 ms
32,876 KB
testcase_06 AC 42 ms
32,876 KB
testcase_07 AC 42 ms
32,876 KB
testcase_08 AC 42 ms
32,876 KB
testcase_09 AC 42 ms
32,876 KB
testcase_10 WA -
testcase_11 AC 43 ms
32,876 KB
testcase_12 AC 41 ms
32,876 KB
testcase_13 AC 49 ms
34,772 KB
testcase_14 AC 48 ms
34,772 KB
testcase_15 AC 50 ms
34,772 KB
testcase_16 AC 50 ms
34,772 KB
testcase_17 AC 52 ms
36,820 KB
testcase_18 AC 64 ms
40,916 KB
testcase_19 WA -
testcase_20 AC 71 ms
47,060 KB
testcase_21 AC 94 ms
55,252 KB
testcase_22 AC 98 ms
59,348 KB
testcase_23 AC 143 ms
59,348 KB
testcase_24 AC 134 ms
59,348 KB
testcase_25 AC 137 ms
59,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
fscanf(STDIN,"%d",$N);
for($i=0;$i<$N-1;++$i){
    fscanf(STDIN,"%d%d",$a,$b);
    $d[$a][] = $b;
    $d[$b][] = $a;
}
$memo = array_fill(0,$N,false);
run($b);
if(array_sum($memo) <= $N-1) echo "Alice" . PHP_EOL;
else echo "Bob" . PHP_EOL;

function run($now){
    global $memo,$d;
    if($memo[$now]) return;
    $memo[$now] = true;
    foreach($d[$now] as $to) run($to);
}


?>
0