結果

問題 No.479 頂点は要らない
ユーザー yuruhiyayuruhiya
提出日時 2020-07-12 12:19:29
言語 Crystal
(1.11.2)
結果
AC  
実行時間 58 ms / 1,500 ms
コード長 332 bytes
コンパイル時間 17,069 ms
コンパイル使用メモリ 255,764 KB
実行使用メモリ 20,368 KB
最終ジャッジ日時 2023-09-13 11:11:08
合計ジャッジ時間 19,831 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,476 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,476 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 2 ms
4,408 KB
testcase_08 AC 2 ms
4,404 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,396 KB
testcase_11 AC 2 ms
4,476 KB
testcase_12 AC 2 ms
4,404 KB
testcase_13 AC 2 ms
4,404 KB
testcase_14 AC 3 ms
4,400 KB
testcase_15 AC 2 ms
4,484 KB
testcase_16 AC 2 ms
4,404 KB
testcase_17 AC 2 ms
4,408 KB
testcase_18 AC 3 ms
4,416 KB
testcase_19 AC 3 ms
4,728 KB
testcase_20 AC 3 ms
4,840 KB
testcase_21 AC 3 ms
4,696 KB
testcase_22 AC 3 ms
4,792 KB
testcase_23 AC 3 ms
4,676 KB
testcase_24 AC 3 ms
4,684 KB
testcase_25 AC 3 ms
4,600 KB
testcase_26 AC 56 ms
14,000 KB
testcase_27 AC 58 ms
13,852 KB
testcase_28 AC 43 ms
20,368 KB
testcase_29 AC 44 ms
10,584 KB
testcase_30 AC 43 ms
10,728 KB
testcase_31 AC 44 ms
10,728 KB
testcase_32 AC 44 ms
10,620 KB
testcase_33 AC 43 ms
10,836 KB
testcase_34 AC 46 ms
10,908 KB
testcase_35 AC 43 ms
9,280 KB
testcase_36 AC 24 ms
7,020 KB
testcase_37 AC 47 ms
11,356 KB
testcase_38 AC 40 ms
10,416 KB
testcase_39 AC 30 ms
10,424 KB
testcase_40 AC 35 ms
11,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = read_line.split.map &.to_i
g = Array.new(n) { [] of Int32 }
m.times do
  u, v = read_line.split.map &.to_i
  g[u] << v
  g[v] << u
end

flag = [false] * n
(n - 1).to(0) do |i|
  next if flag[i]
  g[i].each do |v|
    flag[v] = true
  end
end

ans = flag.reverse.join { |f| f ? '1' : '0' }
puts ans[ans.index('1').not_nil!..]
0