結果
問題 | No.408 五輪ピック |
ユーザー | suppy193 |
提出日時 | 2016-11-02 14:28:40 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 492 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 11,320 KB |
実行使用メモリ | 18,248 KB |
最終ジャッジ日時 | 2023-08-16 12:38:11 |
合計ジャッジ時間 | 9,922 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
15,256 KB |
testcase_01 | AC | 84 ms
15,120 KB |
testcase_02 | AC | 83 ms
15,164 KB |
testcase_03 | AC | 82 ms
15,048 KB |
testcase_04 | AC | 81 ms
15,120 KB |
testcase_05 | WA | - |
testcase_06 | AC | 127 ms
16,304 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 128 ms
16,868 KB |
testcase_11 | AC | 129 ms
16,936 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 98 ms
15,568 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 107 ms
16,080 KB |
testcase_21 | AC | 98 ms
15,748 KB |
testcase_22 | AC | 119 ms
16,508 KB |
testcase_23 | AC | 171 ms
17,948 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 184 ms
18,248 KB |
testcase_27 | AC | 167 ms
16,160 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 81 ms
15,124 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) return if path.length > 5 @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"