結果

問題 No.763 Noelちゃんと木遊び
ユーザー cielciel
提出日時 2018-12-12 00:46:18
言語 Crystal
(1.11.2)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 18,286 ms
コンパイル使用メモリ 256,224 KB
実行使用メモリ 28,012 KB
最終ジャッジ日時 2023-09-13 09:56:52
合計ジャッジ時間 22,429 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
28,012 KB
testcase_01 AC 38 ms
12,316 KB
testcase_02 AC 106 ms
21,048 KB
testcase_03 AC 58 ms
12,752 KB
testcase_04 AC 40 ms
12,140 KB
testcase_05 AC 61 ms
12,868 KB
testcase_06 AC 138 ms
21,152 KB
testcase_07 AC 125 ms
22,632 KB
testcase_08 AC 66 ms
13,292 KB
testcase_09 AC 41 ms
12,296 KB
testcase_10 AC 14 ms
6,652 KB
testcase_11 AC 140 ms
22,760 KB
testcase_12 AC 116 ms
21,248 KB
testcase_13 AC 118 ms
22,088 KB
testcase_14 AC 101 ms
20,260 KB
testcase_15 AC 61 ms
12,468 KB
testcase_16 AC 10 ms
6,584 KB
testcase_17 AC 60 ms
12,868 KB
testcase_18 AC 132 ms
21,384 KB
testcase_19 AC 121 ms
22,644 KB
testcase_20 AC 117 ms
22,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H=Hash(Int32,Array(Int32)).new{|h,k|h[k]=[] of Int32}
V=Hash(Int32,Int32).new
R=[0]
def f(j);a=true;V[j]=1;H[j].each{|e|!V.has_key?(e)&&f(e)&&(a=false)};a&&(R[0]+=1);a end
(gets.not_nil!.to_i-1).times{a,b=gets.not_nil!.split.map &.to_i;H[a]<<b;H[b]<<a}
f 1;p R[0]
0