提出 #36771423


ソースコード 拡げる

(N,X,Y),*UV = $<.map{|ln| ln.split.map(&:to_i) }
E = Array.new(N+1){[]}
UV.each{|u,v|
	E[u]<<v
	E[v]<<u
}

*P = X
until Y==u = P[-1]
	v = E[u].pop
	v = E[u].pop if v==P[-2]
	if v
		P<<v
	else
		P.pop
	end
end

puts P*' '

提出情報

提出日時
問題 C - Simple path
ユーザ ds14050
言語 Ruby (2.7.1)
得点 300
コード長 240 Byte
結果 AC
実行時間 409 ms
メモリ 44396 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 27
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 57 ms 14288 KiB
example_01.txt AC 56 ms 14068 KiB
hand_00.txt AC 57 ms 14184 KiB
hand_01.txt AC 385 ms 44396 KiB
hand_02.txt AC 340 ms 36056 KiB
hand_03.txt AC 380 ms 44140 KiB
hand_04.txt AC 378 ms 44120 KiB
random_00.txt AC 313 ms 37952 KiB
random_01.txt AC 335 ms 38040 KiB
random_02.txt AC 325 ms 38116 KiB
random_03.txt AC 311 ms 38136 KiB
random_04.txt AC 312 ms 38152 KiB
random_05.txt AC 339 ms 38112 KiB
random_06.txt AC 355 ms 38252 KiB
random_07.txt AC 337 ms 38108 KiB
random_08.txt AC 347 ms 37968 KiB
random_09.txt AC 347 ms 37084 KiB
random_10.txt AC 337 ms 37100 KiB
random_11.txt AC 357 ms 37564 KiB
random_12.txt AC 402 ms 42836 KiB
random_13.txt AC 372 ms 42988 KiB
random_14.txt AC 376 ms 43180 KiB
random_15.txt AC 392 ms 43248 KiB
random_16.txt AC 409 ms 42712 KiB
random_17.txt AC 365 ms 37940 KiB
random_18.txt AC 328 ms 36684 KiB
random_19.txt AC 309 ms 36944 KiB