結果

問題 No.675 ドットちゃんたち
ユーザー yuruhiyayuruhiya
提出日時 2021-01-24 10:38:13
言語 Ruby
(3.2.2)
結果
AC  
実行時間 452 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 11,164 KB
実行使用メモリ 40,072 KB
最終ジャッジ日時 2023-08-30 19:05:01
合計ジャッジ時間 6,847 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,124 KB
testcase_01 AC 81 ms
15,340 KB
testcase_02 AC 81 ms
15,208 KB
testcase_03 AC 81 ms
15,284 KB
testcase_04 AC 79 ms
15,200 KB
testcase_05 AC 412 ms
37,920 KB
testcase_06 AC 449 ms
40,072 KB
testcase_07 AC 411 ms
37,148 KB
testcase_08 AC 438 ms
38,160 KB
testcase_09 AC 452 ms
39,380 KB
testcase_10 AC 443 ms
39,692 KB
testcase_11 AC 448 ms
39,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, px, py = gets.split.map(&:to_i)
x1, x2, y1, y2, s = 1, 0, 1, 0, false
puts (1..n).map { gets.split.map(&:to_i) }.reverse.map { |a|
		case a[0]
		when 1
			x2 -= a[1]
		when 2
			y2 -= a[1]
		when 3
			x1, x2, y1, y2, s = -y1, -y2, x1, x2, !s
		end
		x, y = (px - x2) * x1, (py - y2) * y1
		x, y = y, x if s
		[x, y]
     }.reverse.map { _1.join(' ') }.join("\n")
0