結果

問題 No.994 ばらばらコイン
ユーザー simansiman
提出日時 2020-03-11 11:30:57
言語 Ruby
(3.3.0)
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 186 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 11,412 KB
実行使用メモリ 25,468 KB
最終ジャッジ日時 2023-08-10 01:20:12
合計ジャッジ時間 5,909 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,128 KB
testcase_01 AC 84 ms
15,084 KB
testcase_02 AC 318 ms
23,392 KB
testcase_03 AC 334 ms
25,384 KB
testcase_04 AC 324 ms
25,256 KB
testcase_05 AC 192 ms
20,584 KB
testcase_06 AC 326 ms
25,468 KB
testcase_07 AC 331 ms
25,460 KB
testcase_08 AC 249 ms
24,212 KB
testcase_09 AC 316 ms
25,232 KB
testcase_10 AC 255 ms
24,164 KB
testcase_11 AC 270 ms
24,364 KB
testcase_12 AC 289 ms
24,836 KB
testcase_13 AC 81 ms
15,048 KB
testcase_14 AC 83 ms
15,048 KB
testcase_15 AC 82 ms
15,232 KB
testcase_16 AC 82 ms
15,228 KB
testcase_17 AC 82 ms
15,196 KB
testcase_18 AC 81 ms
15,140 KB
testcase_19 AC 81 ms
15,096 KB
testcase_20 AC 83 ms
15,084 KB
testcase_21 AC 82 ms
15,132 KB
testcase_22 AC 81 ms
15,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:13: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)

G = Hash.new { |h, k| h[k] = [] }

(N - 1).times do
  a, b = gets.split.map(&:to_i)

  G[a] << b
  G[b] << a
end

if N < K
  puts -1
else
  puts K - 1
end
0