結果
問題 | No.2301 Namorientation |
ユーザー | siman |
提出日時 | 2023-05-16 13:41:54 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 551 bytes |
コンパイル時間 | 53 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 81,296 KB |
最終ジャッジ日時 | 2024-05-08 10:58:19 |
合計ジャッジ時間 | 26,896 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
12,160 KB |
testcase_01 | AC | 93 ms
12,288 KB |
testcase_02 | AC | 91 ms
12,032 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 87 ms
12,288 KB |
testcase_09 | AC | 87 ms
12,160 KB |
testcase_10 | AC | 86 ms
12,160 KB |
testcase_11 | AC | 87 ms
12,160 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | AC | 686 ms
45,944 KB |
testcase_26 | AC | 817 ms
53,504 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i O = Hash.new { |h, k| h[k] = {} } E = Array.new(N + 1) { [] } OE = [] N.times do a, b = gets.split.map(&:to_i) E[a] << b E[b] << a OE << [a, b] end def dfs(v, par, visited) if par O[par][v] = 1 end return if visited[v] visited[v] = true E[v].each do |u| next if u == par next if visited[u] dfs(u, v, visited) end end visited = Array.new(N + 1, false) 1.upto(N) do |v| next if visited[v] dfs(v, nil, visited) end OE.each do |a, b| if O[a][b] puts '<-' else puts '->' end end