結果

問題 No.583 鉄道同好会
ユーザー letrangerjpletrangerjp
提出日時 2017-10-28 22:43:59
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 168 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2024-05-01 21:36:45
合計ジャッジ時間 13,225 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
12,416 KB
testcase_01 AC 76 ms
12,288 KB
testcase_02 AC 76 ms
12,416 KB
testcase_03 AC 75 ms
12,288 KB
testcase_04 AC 82 ms
12,416 KB
testcase_05 AC 77 ms
12,288 KB
testcase_06 AC 77 ms
12,160 KB
testcase_07 AC 76 ms
12,160 KB
testcase_08 AC 78 ms
12,288 KB
testcase_09 AC 74 ms
12,288 KB
testcase_10 AC 92 ms
12,160 KB
testcase_11 AC 654 ms
14,464 KB
testcase_12 AC 862 ms
14,336 KB
testcase_13 AC 868 ms
14,336 KB
testcase_14 AC 852 ms
14,208 KB
testcase_15 AC 1,123 ms
14,464 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

c=*0..gets.to_i
r=->u{u==c[u]?u:c[u]=r[c[u]]}
h={}
$<.map{|s|eval"h[a=%d]^=1;h[b=%d]^=c[r[a]]=r[b]"%s.split}
puts h.values.count(!p)>2||(h.keys.map(&r)|[])[1]?:NO: :YES
0