結果
問題 | No.812 Change of Class |
ユーザー | letrangerjp |
提出日時 | 2019-04-12 22:25:22 |
言語 | Ruby (3.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 541 bytes |
コンパイル時間 | 470 ms |
コンパイル使用メモリ | 11,152 KB |
実行使用メモリ | 46,280 KB |
最終ジャッジ日時 | 2023-09-03 13:26:52 |
合計ジャッジ時間 | 24,091 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | AC | 96 ms
25,748 KB |
testcase_08 | AC | 82 ms
18,888 KB |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | AC | 168 ms
46,280 KB |
testcase_12 | RE | - |
testcase_13 | AC | 79 ms
15,304 KB |
testcase_14 | AC | 81 ms
15,052 KB |
testcase_15 | RE | - |
testcase_16 | WA | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 115 ms
28,884 KB |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 107 ms
26,408 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | AC | 964 ms
27,956 KB |
testcase_56 | AC | 1,114 ms
23,816 KB |
testcase_57 | AC | 1,177 ms
24,308 KB |
testcase_58 | AC | 652 ms
19,792 KB |
testcase_59 | AC | 1,350 ms
25,448 KB |
testcase_60 | AC | 79 ms
15,352 KB |
testcase_61 | AC | 78 ms
15,260 KB |
testcase_62 | AC | 78 ms
15,084 KB |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split.map &:to_i edges = N.times.map{ [] } M.times{ a, b = gets.split.map &:to_i edges[a-1] << b-1 edges[b-1] << a-1 } Q = gets.to_i Q.times{ a = gets.to_i-1 max_depth = 0 visited = [false] * N f = -> from, depth { return if visited[from] visited[from] = true max_depth = depth if depth > max_depth edges[from].each{|to| f[to, depth + 1] } } if edges[a].empty? puts "0 0" else f[a, 0] puts "#{visited.count(true) - 1} #{max_depth < 2 ? 0 : (max_depth + 1) / 2}" end }