結果
| 問題 |
No.583 鉄道同好会
|
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2017-10-27 23:40:22 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 607 bytes |
| コンパイル時間 | 41 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 15,616 KB |
| 最終ジャッジ日時 | 2024-11-21 23:33:13 |
| 合計ジャッジ時間 | 3,461 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 2 |
コンパイルメッセージ
Syntax OK
ソースコード
n,m=gets.split(" ").map(&:to_i)
cnt=Array.new(n,0)
@edge=Array.new(n){[]}
@visit=Array.new(n){true}
m.times{
a,b=gets.split(" ").map(&:to_i)
cnt[a]^=1
cnt[b]^=1
@edge[a].<<b
@edge[b].<<a
@visit[a]=false
@visit[b]=false
}
def dfs(i)
@visit[i]=true
for j in @edge[i] do
if !@visit[j] then
dfs(j)
end
end
end
def check()
for i in 0...@edge.length do
if @visit[i]==false then
return false
end
end
return true
end
dfs(0)
if check()&&[0,2].include?(cnt.count(1)) then
puts "YES"
else
puts "NO"
end
fiord