結果
問題 | No.408 五輪ピック |
ユーザー | suppy193 |
提出日時 | 2016-11-02 14:17:58 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 465 bytes |
コンパイル時間 | 63 ms |
コンパイル使用メモリ | 11,352 KB |
実行使用メモリ | 24,456 KB |
最終ジャッジ日時 | 2023-08-16 12:37:54 |
合計ジャッジ時間 | 14,737 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 79 ms
15,160 KB |
testcase_01 | AC | 79 ms
15,144 KB |
testcase_02 | AC | 80 ms
15,156 KB |
testcase_03 | AC | 80 ms
15,296 KB |
testcase_04 | AC | 78 ms
15,124 KB |
testcase_05 | WA | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | WA | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | WA | - |
testcase_14 | AC | 388 ms
18,344 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 169 ms
18,132 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | RE | - |
testcase_27 | AC | 418 ms
16,524 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 81 ms
15,112 KB |
コンパイルメッセージ
Syntax OK
ソースコード
n, m = gets.strip.split(' ').map(&:to_i) #p n, m @matrix = [] (1..n).each do |i| @matrix[i] = [] end m.times do s, e = gets.strip.split(' ').map(&:to_i) @matrix[s] << e @matrix[e] << s end #p @matrix s = 1 path = [s] def dfs(v, path) @matrix[v].each do |next_v| if next_v == 1 && path.length == 5 puts "YES" exit end if @matrix[v].include?(next_v) && !path.include?(next_v) dfs(next_v, path << next_v) end end end dfs(s, path) puts "NO"