Submission #40189807


Source Code Expand

def no!; puts'No'; exit end

x,y,TX,TY,L,R,T,B,*A = $<.read.split.map(&:to_i)
no! if 0<1&((TX-x).abs|(TY-y).abs)

X1,X2 = (L..R).lazy.select{ _1!=x }.take(2).to_a.tap{|a| a<<x if a.empty? }
Y1,Y2 = (T..B).lazy.select{ _1!=y }.take(2).to_a.tap{|a| a<<y if a.empty? }
if ! X2 && x!=TX
	A<<"#{X1} #{Y1}"
	x,y = X1+X1-x,Y1+Y1-y
end
if ! Y2 && y!=TY
	A<<"#{X1} #{Y1}"
	x,y = X1+X1-x,Y1+Y1-y
end
no! if ! X2 && x!=TX || ! Y2 && y!=TY

until x==TX && y==TY
	x1,x2 = [[X1,X1],[X2,X1],[X1,X2]][x<=>TX]
	y1,y2 = [[Y1,Y1],[Y2,Y1],[Y1,Y2]][y<=>TY]
#warn "(#{x},#{y})	<#{x1},#{y1}>	(#{x1+x1-x},#{y1+y1-y})"
	A<<"#{x1} #{y1}"
	x,y = x1+x1-x,y1+y1-y
#warn "(#{x},#{y})	<#{x2},#{y2}>	(#{x2+x2-x},#{y2+y2-y})"
	A<<"#{x2} #{y2}"
	x,y = x2+x2-x,y2+y2-y
end

puts 'Yes',A

Submission Info

Submission Time
Task F - Teleporter Takahashi
User ds14050
Language Ruby (2.7.1)
Score 500
Code Size 781 Byte
Status AC
Exec Time 502 ms
Memory 42636 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 4
AC × 43
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 02_handmade_40.txt, 02_handmade_41.txt, 02_handmade_42.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 57 ms 14288 KiB
00_sample_01.txt AC 59 ms 14048 KiB
00_sample_02.txt AC 55 ms 14300 KiB
00_sample_03.txt AC 56 ms 14172 KiB
01_random_04.txt AC 133 ms 20028 KiB
01_random_05.txt AC 55 ms 14284 KiB
01_random_06.txt AC 78 ms 16012 KiB
01_random_07.txt AC 243 ms 28232 KiB
01_random_08.txt AC 62 ms 14224 KiB
01_random_09.txt AC 238 ms 27560 KiB
01_random_10.txt AC 57 ms 14148 KiB
01_random_11.txt AC 56 ms 14140 KiB
01_random_12.txt AC 57 ms 14304 KiB
01_random_13.txt AC 55 ms 14088 KiB
01_random_14.txt AC 199 ms 23460 KiB
01_random_15.txt AC 56 ms 14208 KiB
01_random_16.txt AC 199 ms 23972 KiB
01_random_17.txt AC 110 ms 18380 KiB
01_random_18.txt AC 80 ms 15880 KiB
01_random_19.txt AC 190 ms 23320 KiB
01_random_20.txt AC 59 ms 14244 KiB
01_random_21.txt AC 56 ms 14264 KiB
01_random_22.txt AC 196 ms 23620 KiB
01_random_23.txt AC 57 ms 14260 KiB
01_random_24.txt AC 60 ms 14108 KiB
01_random_25.txt AC 56 ms 14132 KiB
01_random_26.txt AC 56 ms 14332 KiB
01_random_27.txt AC 57 ms 14340 KiB
01_random_28.txt AC 92 ms 16756 KiB
01_random_29.txt AC 62 ms 14112 KiB
01_random_30.txt AC 112 ms 18232 KiB
01_random_31.txt AC 57 ms 14192 KiB
01_random_32.txt AC 113 ms 18348 KiB
01_random_33.txt AC 56 ms 14100 KiB
01_random_34.txt AC 58 ms 14164 KiB
01_random_35.txt AC 57 ms 14228 KiB
01_random_36.txt AC 57 ms 14280 KiB
01_random_37.txt AC 55 ms 14256 KiB
01_random_38.txt AC 56 ms 14012 KiB
01_random_39.txt AC 56 ms 14340 KiB
02_handmade_40.txt AC 253 ms 27632 KiB
02_handmade_41.txt AC 494 ms 42636 KiB
02_handmade_42.txt AC 502 ms 42608 KiB