結果

問題 No.583 鉄道同好会
ユーザー letrangerjpletrangerjp
提出日時 2017-10-28 20:52:15
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 201 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-05-01 21:32:15
合計ジャッジ時間 9,649 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
12,032 KB
testcase_01 AC 78 ms
12,160 KB
testcase_02 AC 80 ms
12,160 KB
testcase_03 AC 79 ms
12,160 KB
testcase_04 AC 85 ms
12,288 KB
testcase_05 AC 80 ms
12,160 KB
testcase_06 AC 82 ms
12,160 KB
testcase_07 AC 78 ms
12,160 KB
testcase_08 AC 79 ms
12,032 KB
testcase_09 AC 81 ms
12,160 KB
testcase_10 AC 78 ms
12,416 KB
testcase_11 AC 338 ms
12,928 KB
testcase_12 AC 560 ms
13,568 KB
testcase_13 AC 480 ms
13,696 KB
testcase_14 AC 491 ms
13,824 KB
testcase_15 AC 607 ms
14,464 KB
testcase_16 AC 1,133 ms
15,232 KB
testcase_17 AC 1,446 ms
15,616 KB
testcase_18 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M = gets.split.map &:to_i
c=*0...N
r=->u{u==c[u]?u:r[c[u]]}
h=[0]*N
x=[]
$<.map{|s|
  a,b=s.split.map &:to_i
  h[a]^=1
  h[b]^=1
  c[r[a]]=r[b]
  x<<a<<b
}
puts h.sum>2||(x.map(&r)|[])[1]?:NO: :YES
0